使用Echarts更新数据或拉取数据的时候遇到下列问题
没法当即触发视图更新、数据格式混乱vue
数据格式混乱ide
//举个栗子 三部曲 避免格式混乱 this.chart.clear() //先清除图表 this.chart.setOption(option, true) //再设置配置 this.chart.hideLoading() //关闭loading
触发视图更新
因为项目使用的vuecli 因此方法以下this
watch: { //监听的对象 x_axis(newVal, oldVal) { //重绘 this.initChart(newVal, this.content) }, y_axis(newVal, oldVal) { this.initChart(newVal, this.content) } },