fix(runtime-core): should not cache property access during data() invocation (#3299)

fix #3297
This commit is contained in:
HcySunYang
2021-03-26 03:48:12 +08:00
committed by GitHub
parent 4bf7ba19bf
commit 6e88156934
3 changed files with 28 additions and 5 deletions

View File

@@ -31,7 +31,7 @@ import {
OptionTypesType,
OptionTypesKeys,
resolveMergedOptions,
isInBeforeCreate
shouldCacheAccess
} from './componentOptions'
import { EmitsOptions, EmitFn } from './componentEmits'
import { Slots } from './componentSlots'
@@ -305,7 +305,7 @@ export const PublicInstanceProxyHandlers: ProxyHandler<any> = {
} else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
accessCache![key] = AccessTypes.CONTEXT
return ctx[key]
} else if (!__FEATURE_OPTIONS_API__ || !isInBeforeCreate) {
} else if (!__FEATURE_OPTIONS_API__ || shouldCacheAccess) {
accessCache![key] = AccessTypes.OTHER
}
}