报错信息如下:

在vue中引用echarts导致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就可以了~

相关文章:

  • 2021-05-02
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-12
  • 2022-12-23
猜你喜欢
  • 2021-04-28
  • 2021-12-31
  • 2021-05-23
  • 2021-12-22
  • 2022-12-23
  • 2022-12-23
  • 2022-01-08
相关资源
相似解决方案