mirror of
https://gitee.com/vuejs/vue.git
synced 2024-12-02 12:07:39 +08:00
add _inactive property
This commit is contained in:
parent
1ca33690c5
commit
3661b4e78e
@ -55,6 +55,7 @@ declare interface Component {
|
||||
_watchers: Array<Watcher>;
|
||||
_data: Object;
|
||||
_events: Object;
|
||||
_inactive: boolean;
|
||||
_isMounted: boolean;
|
||||
_isDestroyed: boolean;
|
||||
_isBeingDestroyed: boolean;
|
||||
|
@ -18,6 +18,7 @@ export function initLifecycle (vm: Component) {
|
||||
vm.$refs = {}
|
||||
|
||||
vm._watcher = null
|
||||
vm._inactive = false
|
||||
vm._isMounted = false
|
||||
vm._isDestroyed = false
|
||||
vm._isBeingDestroyed = false
|
||||
|
@ -146,6 +146,7 @@ function insert (vnode: MountedComponentVNode) {
|
||||
callHook(vnode.child, 'mounted')
|
||||
}
|
||||
if (vnode.data.keepAlive) {
|
||||
vnode.child._inactive = false
|
||||
callHook(vnode.child, 'activated')
|
||||
}
|
||||
}
|
||||
@ -155,6 +156,7 @@ function destroy (vnode: MountedComponentVNode) {
|
||||
if (!vnode.data.keepAlive) {
|
||||
vnode.child.$destroy()
|
||||
} else {
|
||||
vnode.child._inactive = true
|
||||
callHook(vnode.child, 'deactivated')
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user