elementui弹窗不显示echarts图表的问题

点击弹窗调用应该在open中

 //父组件用open方式弹出
 handleSearch (id) {
    
    
      this.$refs.orderDetail.open(id)
 }

//子组件在open方法中调用
  async open (id) {
    
    
      this.dialogVisible = true;
      this.fenleizhanbiChart()
      this.getzaodiandingdanliangtongjiChart()
  }

用this.$nextTick包一下

 this.$nextTick(() => {
    
    
        // 初始化代码
        const chartDom = document.getElementById('Chart');
        const myChart = echarts.init(chartDom);
        const option = {
    
    ...};
        myChart.setOption(option);
 })this.$nextTick(() => {
    
    
        // 初始化代码
        const myChart = echarts.init(this.$refs.Chart);
        const option = {
    
    ...};
        myChart.setOption(option);
 })

猜你喜欢

转载自blog.csdn.net/XiaoCaiHenMiMang/article/details/140817155
今日推荐