You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -20,101 +20,21 @@ Not ready yet? Read documentation for older versions [here →](https://github.c
20
20
$ npm install echarts vue-echarts
21
21
```
22
22
23
-
To make `vue-echarts` work for *Vue 2* (<2.7.0), you need to have `@vue/composition-api` installed:
23
+
To make `vue-echarts` work for _Vue 2_ (<2.7.0), you need to have `@vue/composition-api` installed:
24
24
25
25
```sh
26
26
npm i -D @vue/composition-api
27
27
```
28
28
29
-
If you are using *NuxtJS* on top of *Vue 2* (<2.7.0), you'll also need `@nuxtjs/composition-api`:
29
+
If you are using _NuxtJS_ on top of _Vue 2_ (<2.7.0), you'll also need `@nuxtjs/composition-api`:
30
30
31
31
```sh
32
32
npm i -D @nuxtjs/composition-api
33
33
```
34
34
35
35
And then add `'@nuxtjs/composition-api/module'` in the `buildModules` option in your `nuxt.config.js`.
36
36
37
-
<details>
38
-
<summary>Vue 3</summary>
39
-
40
-
```js
41
-
import { createApp } from'vue'
42
-
importEChartsfrom'vue-echarts'
43
-
import { use } from"echarts/core"
44
-
45
-
// import ECharts modules manually to reduce bundle size
46
-
import {
47
-
CanvasRenderer
48
-
} from'echarts/renderers'
49
-
import {
50
-
BarChart
51
-
} from'echarts/charts'
52
-
import {
53
-
GridComponent,
54
-
TooltipComponent
55
-
} from'echarts/components'
56
-
57
-
use([
58
-
CanvasRenderer,
59
-
BarChart,
60
-
GridComponent,
61
-
TooltipComponent
62
-
])
63
-
64
-
constapp=createApp(...)
65
-
66
-
// register globally (or you can do it locally)
67
-
app.component('v-chart', ECharts)
68
-
69
-
app.mount(...)
70
-
```
71
-
72
-
</details>
73
-
74
-
<details>
75
-
<summary>Vue 2</summary>
76
-
77
-
```js
78
-
importVuefrom'vue'
79
-
importEChartsfrom'vue-echarts'
80
-
import { use } from'echarts/core'
81
-
82
-
// import ECharts modules manually to reduce bundle size
83
-
import {
84
-
CanvasRenderer
85
-
} from'echarts/renderers'
86
-
import {
87
-
BarChart
88
-
} from'echarts/charts'
89
-
import {
90
-
GridComponent,
91
-
TooltipComponent
92
-
} from'echarts/components'
93
-
94
-
use([
95
-
CanvasRenderer,
96
-
BarChart,
97
-
GridComponent,
98
-
TooltipComponent
99
-
]);
100
-
101
-
// register globally (or you can do it locally)
102
-
Vue.component('v-chart', ECharts)
103
-
104
-
newVue(...)
105
-
```
106
-
107
-
</details>
108
-
109
-
We encourage manually importing components and charts from ECharts for smaller bundle size. See all supported renderers/charts/components [here →](https://github.com/apache/echarts/blob/master/src/echarts.all.ts)
110
-
111
-
But if you really want to import the whole ECharts bundle without having to import modules manually, just add this in your code:
We encourage manually importing components and charts from ECharts for smaller bundle size. See all supported renderers/charts/components [here →](https://github.com/apache/echarts/blob/master/src/echarts.all.ts)
212
+
213
+
But if you really want to import the whole ECharts bundle without having to import modules manually, just add this in your code:
214
+
215
+
```js
216
+
import"echarts";
217
+
```
218
+
302
219
### CDN & Global variable
303
220
304
221
Drop `<script>` inside your HTML file and access the component via `window.VueECharts`.
@@ -448,6 +365,7 @@ import { THEME_KEY } from 'vue-echarts'
448
365
> }
449
366
> }
450
367
>```
368
+
451
369
</details>
452
370
453
371
### Methods
@@ -479,7 +397,7 @@ You can bind events with Vue's `v-on` directive.
0 commit comments