vue 销毁组件、重置组件方式

时间:2021-08-21 20:11:32   收藏:0   阅读:15

1.使用v-if

  在组件上定义v-if一个布尔变量

  1.变量改为false

  2.变量改为true

2.

import dialog from ‘@compintent/dialog‘
components: {dialog}
this.$destroy(‘dialog‘);

 

3.

// get~ 销毁组件
destroyElement() {
  this.$destroy(true);
  this.$el.parentNode.removeChild(this.$el);
},

原文:https://www.cnblogs.com/DeerLin/p/15170148.html

评论(0)
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!