From: zhangenming <282126346@qq.com> Date: Tue, 9 Jan 2024 07:26:07 +0000 (+0800) Subject: refactor(runtime-core): use currentRenderingInstance directly X-Git-Tag: v3.4.7~5 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=64e9c9616dc806374204f0d0fbbc477e1209af00;p=thirdparty%2Fvuejs%2Fcore.git refactor(runtime-core): use currentRenderingInstance directly --- diff --git a/packages/runtime-core/src/directives.ts b/packages/runtime-core/src/directives.ts index a3b44d4c8f..daaf28b151 100644 --- a/packages/runtime-core/src/directives.ts +++ b/packages/runtime-core/src/directives.ts @@ -88,14 +88,13 @@ export function withDirectives( 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]