Skip to content

Commit

Permalink
feat: allow passing directive definition directly to h() (#12590)
Browse files Browse the repository at this point in the history
  • Loading branch information
KaelWD authored Jul 4, 2022
1 parent caceece commit 5f71044
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/core/vdom/modules/directives.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ function normalizeDirectives(
// $flow-disable-line
return res
}
let i, dir
let i: number, dir: VNodeDirective
for (i = 0; i < dirs.length; i++) {
dir = dirs[i]
if (!dir.modifiers) {
Expand All @@ -103,7 +103,7 @@ function normalizeDirectives(
}
res[getRawDirName(dir)] = dir
if (vm._setupState && vm._setupState.__sfc) {
dir.def = resolveAsset(vm, '_setupState', 'v-' + dir.name)
dir.def = dir.def || resolveAsset(vm, '_setupState', 'v-' + dir.name)
}
dir.def = dir.def || resolveAsset(vm.$options, 'directives', dir.name, true)
}
Expand Down
2 changes: 2 additions & 0 deletions types/vnode.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Vue } from './vue'
import { DirectiveFunction, DirectiveOptions } from './options'

export type ScopedSlot = (props: any) => ScopedSlotReturnValue
type ScopedSlotReturnValue =
Expand Down Expand Up @@ -86,4 +87,5 @@ export interface VNodeDirective {
arg?: string
oldArg?: string
modifiers?: { [key: string]: boolean }
def?: DirectiveFunction | DirectiveOptions
}

0 comments on commit 5f71044

Please sign in to comment.