elementui tab切换时,echart图显示宽度问题

在tab内部定义多个echart。切换tab时候发现 echart图形宽度变成100px;聚合成一坨

这里只需要在tab 的click事件中吗,加入

this.$nextTick(() => {
        。。。。
        })

 

 <el-tabs v-model="activeName" @tab-click="handleClick">
  //tab选择事件
        handleClick(tab, event) {
            let tabPageName = tab.paneName;
            if(tabPageName==="first"){
                this.tabPageIndex=0;
                this.$nextTick(() => {
                    this.drawLine();//历史曲线
                })
            }else if(tabPageName==="second"){
                this.tabPageIndex=1;
                this.$nextTick(() => {
                    this.drawNHLine();
                })
            }
        },

 

posted @ 2021-07-19 10:24  创客未来  阅读(372)  评论(0)    收藏  举报