Skip to content

Commit

Permalink
fix: directive callback should be called in udpate hook
Browse files Browse the repository at this point in the history
  • Loading branch information
Clarkkkk committed Jul 1, 2023
1 parent 0195dca commit b3e50e9
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ export function ViewTransitionsPlugin(): Plugin {
app.directive('view-transition-name', {
beforeMount(el, binding) {
el.style.viewTransitionName = binding.value
},
beforeUpdate(el, binding) {
el.style.viewTransitionName = binding.value
}
})
}
Expand All @@ -21,6 +24,10 @@ export function ViewTransitionsLegacyPlugin(): LegacyPlugin<void> {
bind(el: HTMLElement, binding: DirectiveBinding) {
// eslint-disable-next-line @typescript-eslint/no-extra-semi
;(el.style as any).viewTransitionName = binding.value
},
update(el: HTMLElement, binding: DirectiveBinding) {
// eslint-disable-next-line @typescript-eslint/no-extra-semi
;(el.style as any).viewTransitionName = binding.value
}
})
}
Expand Down

0 comments on commit b3e50e9

Please sign in to comment.