vue.js - how can component delete itself in Vue 2.0 -
as title, how can that
from offical documentation tell $delete can use argument 'object' , 'key'
but want delete component this
this.$delete(this)
no, not able delete component directly. parent component have use v-if
remove child component dom.
ref: https://vuejs.org/v2/api/#v-if
quoted docs:
conditionally render element based on truthy-ness of expression value. element , contained directives / components destroyed , re-constructed during toggles.
if child component created part of data object on parent, have send event parent via $emit
, modify (or remove) data , child component go away on own. there question on recently: delete vue child component
Comments
Post a Comment