feat(core): keep-alive

This commit is contained in:
Evan You
2019-10-29 22:28:38 -04:00
parent 083296ead6
commit c6cbca25fe
11 changed files with 351 additions and 53 deletions

View File

@@ -264,13 +264,14 @@ export function cloneVNode<T, U>(
appContext: vnode.appContext,
dirs: vnode.dirs,
// these should be set to null since they should only be present on
// mounted VNodes. If they are somehow not null, this means we have
// encountered an already-mounted vnode being used again.
component: null,
suspense: null,
el: null,
anchor: null
// These should technically only be non-null on mounted VNodes. However,
// they *should* be copied for kept-alive vnodes. So we just always copy
// them since them being non-null during a mount doesn't affect the logic as
// they will simply be overwritten.
component: vnode.component,
suspense: vnode.suspense,
el: vnode.el,
anchor: vnode.anchor
}
}