Custom Directives
Introduction
<script setup>
// Enables v-focus in templates
const vFocus = {
mounted: (el) => el.focus()
}
</script>
<template>
<input v-focus />
</template>export default {
setup() {
// ...
},
directives: {
// Enables v-focus in template
focus: {
// ...
}
}
}Directive Hooks
Function Shorthand
Last updated