el-dialog中中使用echarts

1、在dialog中使用open方法

<el-dialog
        :title="diaTitle"
        :visible.sync="dialogVisible"
        @open="open()"
      >
</el-dialog>      

2、在定时函数setTimeout中执行方法

open() {
  const t = this;
  setTimeout(() => {
    //  执行echarts画图方法
    t.drawLine();
  }, 0);
}

3、图表宽度自适应(当设置100%无效时)

let ghdlChart = this.$echarts.init(document.getElementById('ghdlEchart'));

 this.$nextTick(() => {//自适应宽度

        ghdlChart.resize();

})

4、饼图直观查看标注

 

 

posted @ 2022-04-13 09:46  seven&night  阅读(393)  评论(0编辑  收藏  举报