mirror of
https://gitee.com/vuejs/vue.git
synced 2024-11-30 02:57:43 +08:00
parent
5221d4d3b6
commit
2263948c24
@ -103,7 +103,15 @@ function normalizeDirectives(
|
||||
}
|
||||
res[getRawDirName(dir)] = dir
|
||||
if (vm._setupState && vm._setupState.__sfc) {
|
||||
dir.def = dir.def || resolveAsset(vm, '_setupState', 'v-' + dir.name)
|
||||
const setupDef = dir.def || resolveAsset(vm, '_setupState', 'v-' + dir.name)
|
||||
if (typeof setupDef === 'function') {
|
||||
dir.def = {
|
||||
bind: setupDef,
|
||||
update: setupDef,
|
||||
}
|
||||
} else {
|
||||
dir.def = setupDef
|
||||
}
|
||||
}
|
||||
dir.def = dir.def || resolveAsset(vm.$options, 'directives', dir.name, true)
|
||||
}
|
||||
|
@ -251,6 +251,19 @@ describe('api: setup context', () => {
|
||||
expect(spy).toHaveBeenCalled()
|
||||
})
|
||||
|
||||
// #12743
|
||||
it('directive resolution for shorthand', () => {
|
||||
const spy = vi.fn()
|
||||
new Vue({
|
||||
setup: () => ({
|
||||
__sfc: true,
|
||||
vDir: spy
|
||||
}),
|
||||
template: `<div v-dir />`
|
||||
}).$mount()
|
||||
expect(spy).toHaveBeenCalled()
|
||||
})
|
||||
|
||||
// #12561
|
||||
it('setup props should be reactive', () => {
|
||||
const msg = ref('hi')
|
||||
|
Loading…
Reference in New Issue
Block a user