refactor(runtime-core): refactor instance public proxy context object

This commit is contained in:
Evan You
2020-04-16 12:49:50 -04:00
parent b2662a62c5
commit 370fc820cc
6 changed files with 131 additions and 154 deletions

View File

@@ -949,7 +949,7 @@ function baseCreateRenderer(
) => {
if (n1 == null) {
if (n2.shapeFlag & ShapeFlags.COMPONENT_KEPT_ALIVE) {
;(parentComponent!.proxyTarget as KeepAliveContext).activate(
;(parentComponent!.ctx as KeepAliveContext).activate(
n2,
container,
anchor,
@@ -998,7 +998,7 @@ function baseCreateRenderer(
// inject renderer internals for keepAlive
if (isKeepAlive(initialVNode)) {
;(instance.proxyTarget as KeepAliveContext).renderer = internals
;(instance.ctx as KeepAliveContext).renderer = internals
}
// resolve props and slots for setup context
@@ -1719,7 +1719,7 @@ function baseCreateRenderer(
if (shapeFlag & ShapeFlags.COMPONENT) {
if (shapeFlag & ShapeFlags.COMPONENT_SHOULD_KEEP_ALIVE) {
;(parentComponent!.proxyTarget as KeepAliveContext).deactivate(vnode)
;(parentComponent!.ctx as KeepAliveContext).deactivate(vnode)
} else {
unmountComponent(vnode.component!, parentSuspense, doRemove)
}