vue强制更新子组件

阅读 53

2022-02-08

1、强制重新刷新某组件

this.$forceUpdate()

 2、绑定 key

//模版上绑定key
<SomeComponent :key="theKey"/>
//选项里绑定data
data(){
  return{
      theKey:0
  }
}
//刷新key达到刷新组件的目的
theKey++;

3、v-if

相关推荐

精彩评论(0)

0 0 举报