add _inactive property

This commit is contained in:
Evan You 2016-06-28 04:00:32 -04:00
parent 1ca33690c5
commit 3661b4e78e
3 changed files with 4 additions and 0 deletions

View File

@ -55,6 +55,7 @@ declare interface Component {
_watchers: Array<Watcher>;
_data: Object;
_events: Object;
_inactive: boolean;
_isMounted: boolean;
_isDestroyed: boolean;
_isBeingDestroyed: boolean;

View File

@ -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

View File

@ -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')
}
}