Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
4.1k views
in Technique[技术] by (71.8m points)

vue同时设置组件和和div显示或隐藏时Ecarts会清空

需求时点击一个菜单要显示菜单的描述,同时在显示子菜单。
子菜单为组件,描述为div

`<!--测试组件-->

<ceshi v-if="ceshishow"></ceshi>
<!--菜单-->
<div class="memu-div" v-if="waterelectricmenu">

    <span class="angle"></span>
    <ul id="memu-ul">
        <li @click="homeitemclick('water')"><a><span class="iconfont icon-order"></span>用水管理</a></li>
        <li @click="homeitemclick('electric')"><a><span class="iconfont icon-affair"></span>用电管理</a></li>
    </ul>
</div>`

在点击事件中使用
`if (this.ceshishow) {
                this.ceshishow = false;
                this.waterelectricmenu = false;
            }
            else{
                this.ceshishow = true;
                this.waterelectricmenu = true;
            }
  }`
  
  结果页面上的echarts图表被清空了。
  单独设置this.ceshishow = false;或者this.waterelectricmenu = false;时,图表都不会清空,只有同时设置这两个的时候才会出现

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神解答

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...