'How to execute a directive right when rendering DOM in VUE
I'm trying to define a directive and I need to be executed right when DOM is rendered.
I was reading about different hooks, but inserted () or update () hook doesnt do the trick. This is my directive:
Vue.directive('validation-directive', {
bind (el, binding, vNode) {
addValidation(el, binding)
},
inserted (el, binding, vNode) {
addValidation(el, binding)
},
stopProp (event) { event.stopPropagation() }
})
function addValidation (el, binding) {
console.log(el)
}
Anyone knows how to do it? Thanks!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
