Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: allow passing directive definition directly to h() #12590

Merged
merged 3 commits into from Jul 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/core/vdom/modules/directives.ts
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
@@ -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
}