mirror of
https://github.com/vuejs/vue.git
synced 2024-11-21 20:28:54 +00:00
feat: allow passing directive definition directly to h() (#12590)
This commit is contained in:
parent
427028ad89
commit
d45bbeac27
@ -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) {
|
||||
@ -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)
|
||||
}
|
||||
|
2
types/vnode.d.ts
vendored
2
types/vnode.d.ts
vendored
@ -1,4 +1,5 @@
|
||||
import { Vue } from './vue'
|
||||
import { DirectiveFunction, DirectiveOptions } from './options'
|
||||
|
||||
export type ScopedSlot = (props: any) => ScopedSlotReturnValue
|
||||
type ScopedSlotReturnValue =
|
||||
@ -86,4 +87,5 @@ export interface VNodeDirective {
|
||||
arg?: string
|
||||
oldArg?: string
|
||||
modifiers?: { [key: string]: boolean }
|
||||
def?: DirectiveFunction | DirectiveOptions
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user