Hello!!
how to use directive in nuxt.js?
plugins: ['~plugins/filters.js','~plugins/directive.js'];
Vue.directive('nferror', {
bind: function() {
console.log("bind")
},
update: function() {
},
unbind: function() {
}
});
<p class="font-count" nferror :class="isError"></p>
It's not working
Hi @SzHeJason
it works, please read Vue.js documentation to know how it works.
You need to use v- in front of your custom directive:
<p v-nferror></p>
Demo: https://standing-spot.glitch.me/ (look at the console)
Code: https://glitch.com/edit/#!/standing-spot?path=pages/index.vue:3:11
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Most helpful comment
Hi @SzHeJason
it works, please read Vue.js documentation to know how it works.
You need to use
v-in front of your custom directive:Demo: https://standing-spot.glitch.me/ (look at the console)
Code: https://glitch.com/edit/#!/standing-spot?path=pages/index.vue:3:11