主要是利用v-if的重建銷燬特性來重置:
<div class="flexdiv" v-if="isRouterAlive">
<my-component>...</my-component>
</div>
然後在data裏:
isRouterAlive:true
在需要重置的地方:
this.isRouterAlive = false
this.$nextTick(() => (this.isRouterAlive = true))
主要是利用v-if的重建銷燬特性來重置:
<div class="flexdiv" v-if="isRouterAlive">
<my-component>...</my-component>
</div>
然後在data裏:
isRouterAlive:true
在需要重置的地方:
this.isRouterAlive = false
this.$nextTick(() => (this.isRouterAlive = true))