【vue】组件重置刷新

主要是利用v-if的重建销毁特性来重置:

<div class="flexdiv" v-if="isRouterAlive">

          <my-component>...</my-component>

</div>

 然后在data里:

isRouterAlive:true

 在需要重置的地方:

this.isRouterAlive = false

this.$nextTick(() => (this.isRouterAlive = true))

发布了283 篇原创文章 · 获赞 21 · 访问量 20万+

猜你喜欢

转载自blog.csdn.net/dangbai01_/article/details/103023491