全局使用
npm i echarts -s
main js里面使用
import * as echarts from 'echarts'
Vue.prototype.$echarts = echarts
直接使用:
需要先创建容器
<div id="main" style="width:600px;height:400px"></div>
然后使用
this.$echarts.init(document.getElementById('main'))
单独页面使用
建立容器再设置相对应的容器大小 不设置就无法显示哦
<div id="pie" style=“width:500px;height:500px”> </div>
页面引入
important echarts from “echarts”
进行初始化
var myChart = echarts.init(document.getElementById('pie'))
进入主题
myChart.setOption ({ ......... })