Selaa lähdekoodia

refactor(runtime-core): use currentRenderingInstance directly

zhangenming 2 vuotta sitten
vanhempi
commit
64e9c9616d
1 muutettua tiedostoa jossa 3 lisäystä ja 4 poistoa
  1. 3 4
      packages/runtime-core/src/directives.ts

+ 3 - 4
packages/runtime-core/src/directives.ts

@@ -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]