主要是利用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))