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
441 views
in Technique[技术] by (71.8m points)

watch 监听数据如何重新加载dom

 <ul v-if="isShow">
    <li>第一行</li>
    <li>第二行</li>
    <li>第三行</li>
    <li>第四行</li>
    <li>第五行</li>
 </ul>
 
 data(){
   return {
    isShow: ''
   }
 }
 
watch: {
  hideElement(val, oldVal) {
    if (val) {
      this.isShow = false;
    } else {
      this.isShow = true;
    }
}

在watch里监听了一个值的变化, 用来控制某个div的显示与否,如果想要在watch里监听到数值变化后,不请求后端接口的情况下,如何让整个页面的dom 重新加载?求大神指点


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

1 Answer

0 votes
by (71.8m points)

this.$forceUpdate()?


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

...