parent
48e8f2c196
commit
19fb55febf
|
@ -68,8 +68,9 @@ export function withDirectives<T extends Node>(
|
||||||
return node
|
return node
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!currentInstance.dirs.has(node)) currentInstance.dirs.set(node, [])
|
const instance = currentInstance
|
||||||
const bindings = currentInstance.dirs.get(node)!
|
if (!instance.dirs.has(node)) instance.dirs.set(node, [])
|
||||||
|
const bindings = instance.dirs.get(node)!
|
||||||
|
|
||||||
for (const directive of directives) {
|
for (const directive of directives) {
|
||||||
let [dir, source, arg, modifiers] = directive
|
let [dir, source, arg, modifiers] = directive
|
||||||
|
@ -83,7 +84,7 @@ export function withDirectives<T extends Node>(
|
||||||
|
|
||||||
const binding: DirectiveBinding = {
|
const binding: DirectiveBinding = {
|
||||||
dir,
|
dir,
|
||||||
instance: currentInstance,
|
instance,
|
||||||
source,
|
source,
|
||||||
value: null, // set later
|
value: null, // set later
|
||||||
oldValue: null,
|
oldValue: null,
|
||||||
|
@ -93,8 +94,9 @@ export function withDirectives<T extends Node>(
|
||||||
bindings.push(binding)
|
bindings.push(binding)
|
||||||
|
|
||||||
callDirectiveHook(node, binding, 'created')
|
callDirectiveHook(node, binding, 'created')
|
||||||
|
|
||||||
effect(() => {
|
effect(() => {
|
||||||
if (!currentInstance!.isMountedRef.value) return
|
if (!instance.isMountedRef.value) return
|
||||||
callDirectiveHook(node, binding, 'updated')
|
callDirectiveHook(node, binding, 'updated')
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue