Skip to content

Commit

Permalink
feat: provides a shorthand v-trans for v-view-transition-name
Browse files Browse the repository at this point in the history
  • Loading branch information
Clarkkkk committed Jul 29, 2023
1 parent 1b19096 commit 4bb3f69
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,15 @@ export function ViewTransitionsPlugin(): Plugin {
setViewTransitionName(el, binding.value)
}
})

app.directive('trans', {
beforeMount(el, binding) {
setViewTransitionName(el, binding.value)
},
beforeUpdate(el, binding) {
setViewTransitionName(el, binding.value)
}
})
}
}
}
Expand All @@ -39,6 +48,10 @@ export function ViewTransitionsLegacyPlugin(): LegacyPlugin<void> {
setViewTransitionName(el, binding.value)
}
)

Vue.directive('trans', function (el: HTMLElement, binding: DirectiveBinding) {
setViewTransitionName(el, binding.value)
})
}
}
}

0 comments on commit 4bb3f69

Please sign in to comment.