docs: update examples in readme (#524)

This commit is contained in:
565871779
2021-03-11 14:55:46 +08:00
committed by GitHub
parent e10e588d99
commit accab93ea1
2 changed files with 34 additions and 2 deletions

View File

@ -32,6 +32,7 @@ npm i -D @vue/composition-api
```js
import { createApp } from 'vue'
import ECharts from 'vue-echarts'
import { use } from "echarts/core"
// import ECharts modules manually to reduce bundle size
import {
@ -45,6 +46,13 @@ import {
TooltipComponent
} from 'echarts/components'
use([
CanvasRenderer,
BarChart,
GridComponent,
TooltipComponent
])
const app = createApp(...)
// register globally (or you can do it locally)
@ -61,8 +69,9 @@ app.mount(...)
```js
import Vue from 'vue'
import ECharts from 'vue-echarts'
import { use } from 'echarts/core'
// import ECharts modules manually to reduce bundle size
import {
CanvasRenderer
} from 'echarts/renderers'
@ -74,6 +83,13 @@ import {
TooltipComponent
} from 'echarts/components'
use([
CanvasRenderer,
BarChart,
GridComponent,
TooltipComponent
]);
// register globally (or you can do it locally)
Vue.component('v-chart', ECharts)

View File

@ -30,6 +30,7 @@ npm i -D @vue/composition-api
```js
import { createApp } from 'vue'
import ECharts from 'vue-echarts'
import { use } from "echarts/core";
// 手动引入 ECharts 各模块来减小打包体积
import {
@ -43,6 +44,13 @@ import {
TooltipComponent
} from 'echarts/components'
use([
CanvasRenderer,
BarChart,
GridComponent,
TooltipComponent
]);
const app = createApp(...)
// 全局注册组件(也可以使用局部注册)
@ -59,8 +67,9 @@ app.mount(...)
```js
import Vue from 'vue'
import ECharts from 'vue-echarts'
import { use } from 'echarts/core'
// 手动引入 ECharts 各模块来减小打包体积
import {
CanvasRenderer
} from 'echarts/renderers'
@ -72,6 +81,13 @@ import {
TooltipComponent
} from 'echarts/components'
use([
CanvasRenderer,
BarChart,
GridComponent,
TooltipComponent
]);
// 全局注册组件(也可以使用局部注册)
Vue.component('v-chart', ECharts)