强制刷新组件
2021-02-21 本文已影响0人
落花夕拾
//div
<component
v-if="isrefresh"
:is="modelComponent"
/>
data() {
return {
isrefresh: true,
modelComponent: ''
}
},
handleTabClick(index) {
if (this.dataType === index) {
return;
}
this.isrefresh = this.isrefresh ? false : true
if (this.canGoOn()) {
this.dataType = index;
if (index !== 0 ) {
this.$nextTick(()=>{ //强制刷新组件
this.isrefresh = this.isrefresh ? false : true
this.modelComponent = 'datamodel';
})
}
}
},