vue echars Cannot read property 'getAttribute' of null

之前一直用echarts没有出现过这个问题,所以当这个问题出现时我就开始了各种查,试了几种方法依旧报错,比如:

1、在mounted() {},写成如下形式:(依旧报错)

this.$nextTick(() => {
this.initChartLine();
});
2、(依旧报错)

setTimeout(() => {
this.initChartLine();
}, 10);
3、正确的方法

因为我在包裹echarts标签的最外层加了v-if,所以导致了报错,只要把v-if改成v-show就可以了~

你可能感兴趣的:(vue echars Cannot read property 'getAttribute' of null)