欢迎您光临自学哈网,只为分享网络知识教程,供大家学习参考!

「自学哈网」element-ui 在对话框中使用echarts,报错信息’没有获取到dom’?

作者 : 自学哈 本文共569个字,预计阅读时间需要2分钟 2023-06-7 共111人阅读
也想出现在这里? 联系我们
  • 给el-dialog添加@open=”open()”
  • 在刚进入页面的时候对话框是关闭的,echarts不进行获取dom,当点击对话框出来的时候,有个opened事件,在这个事件里边进行echarts的初始化,执行数据;
    <el-dialog
       lock-scroll
       width="80%"
       style="height:100%;"
       @opened="opens">
       <div style="display:flex;">
           <div ref="chart1"></div>
           <div ref="chart2"></div>
       </div>
    </el-dialog>
    
    methods:{
        initChart1() {
             this.chart1 = this.$echarts.init(this.$refs.chart1)
             this.chart1.setOption(this.chart1option)
         },
         initChart2() {
             this.chart2 = this.$echarts.init(this.$refs.chart2)
             this.chart2.setOption(this.chart2option)
         },
         // 进行echarts的初始化,执行数据
         opens(){
             this.$nextTick(() => {
                this.initChart1()
                this.initChart2()
             })
         }
    

     

本站声明:
本站所有资源来源于网络,分享目的仅供大家学习和交流!如若本站内容侵犯了原著者的合法权益,可联系邮箱976157886@qq.com进行删除。
自学哈专注于免费提供最新的分享知识、网络教程、网络技术的资源分享平台,好资源不私藏,大家一起分享!

自学哈网 » 「自学哈网」element-ui 在对话框中使用echarts,报错信息’没有获取到dom’?
也想出现在这里? 联系我们
© 2022 Theme by - 自学哈网 & WordPress Theme. All rights reserved 浙ICP备2022016594号