mpvue实现动态加载echarts图表数据
# install dependencies
npm install
# serve with hot reload at localhost:8080
npm run dev
# build for production with minification
npm run build
# build for production and view the bundle analyzer report
npm run build --report
在mpvue官方修改ec-canvas.js
的基础上,再次对ec-canvas/ec-canvas.js
进行调整
设置setOption
函数
setOptions () {
this.chart.clear()
this.chart.setOption(this.data.ec.options)
},
设置ec
被更改时执行setOptions
函数
properties: {
canvasId: {
type: String,
value: 'ec-canvas'
},
ec: {
type: Object,
observer: function () {
this.setOptions()
}
}
},