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

@@ -73,7 +73,7 @@ export const PublicInstanceProxyHandlers: ProxyHandler<any> = {
propsProxy,
accessCache,
type,
user
sink
} = target
// fast path for unscopables when using `with` block
if (__RUNTIME_COMPILE__ && (key as any) === Symbol.unscopables) {
@@ -128,8 +128,8 @@ export const PublicInstanceProxyHandlers: ProxyHandler<any> = {
return instanceWatch.bind(target)
}
}
if (hasOwn(user, key)) {
return user[key]
if (hasOwn(sink, key)) {
return sink[key]
} else if (__DEV__ && currentRenderingInstance != null) {
warn(
`Property ${JSON.stringify(key)} was accessed during render ` +
@@ -157,7 +157,7 @@ export const PublicInstanceProxyHandlers: ProxyHandler<any> = {
warn(`Attempting to mutate prop "${key}". Props are readonly.`, target)
return false
} else {
target.user[key] = value
target.sink[key] = value
}
return true
}