Skip to content

Commit

Permalink
refactor(runtime-core): use currentRenderingInstance directly
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangenming authored Jan 9, 2024
1 parent 9c54dac commit 64e9c96
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions packages/runtime-core/src/directives.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down

0 comments on commit 64e9c96

Please sign in to comment.