refactor(runtime-core): use currentRenderingInstance directly

This commit is contained in:
zhangenming 2024-01-09 15:26:07 +08:00 committed by GitHub
parent 9c54dacd0d
commit 64e9c9616d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 4 deletions

View File

@ -88,14 +88,13 @@ export function withDirectives<T extends VNode>(
vnode: T,
directives: DirectiveArguments,
): T {
const internalInstance = currentRenderingInstance
if (internalInstance === null) {
if (currentRenderingInstance === null) {
__DEV__ && warn(`withDirectives can only be used inside render functions.`)
return vnode
}
const instance =
(getExposeProxy(internalInstance) as ComponentPublicInstance) ||
internalInstance.proxy
(getExposeProxy(currentRenderingInstance) as ComponentPublicInstance) ||
currentRenderingInstance.proxy
const bindings: DirectiveBinding[] = vnode.dirs || (vnode.dirs = [])
for (let i = 0; i < directives.length; i++) {
let [dir, value, arg, modifiers = EMPTY_OBJ] = directives[i]