Nuxt.js: Vue directive

Created on 8 Jun 2017  路  2Comments  路  Source: nuxt/nuxt.js

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

This question is available on Nuxt.js community (#c737)
help-wanted

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:

<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

All 2 comments

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

gary149 picture gary149  路  3Comments

mikekidder picture mikekidder  路  3Comments

surmon-china picture surmon-china  路  3Comments

shyamchandranmec picture shyamchandranmec  路  3Comments

bimohxh picture bimohxh  路  3Comments