Membuat Directive
const vFocus = {
mounted(el) {
el.focus()
}
}
---template---
<input v-focus id="auto-focus" />
Directive dengan Parameter
const vColor = {
mounted(el, binding) {
el.style.color = binding.value
}
}
---template---
<p v-color="'blue'" id="colored">Teks biru</p>