网上找了些朋友说是,什么要将加载放到mounted的this.$nextTick中,其实不然,是我吧refs 的值写错了

现在我们就来开始找错…

html

<template>
    <div class="echart-box"  style="width: 280px;
       height:220px" ref="line_only_dom"></div>
</template>

js

  mounted() {
      this.drawLine();
  },
  methods: {
      drawLine() {
          let self = this;
          let line_dom = this.$refs.line_dom;
          this.mychart = this.$echarts.init(line_dom);

	}
}

找到错误了吧

只要吧 let line_dom = this.$refs.line_dom; 改为 let line_only_dom = this.$refs.line_only_dom; 问题即可解决

相关文章:

  • 2021-07-01
  • 2021-06-21
  • 2021-06-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-09-21
  • 2021-09-14
  • 2021-08-28
  • 2021-07-16
  • 2021-09-09
  • 2021-06-26
  • 2021-05-18
相关资源
相似解决方案