Static GitHub Issues

[3127] Where do custom directives belong?

prev: <nuxt-link to="/" append> don't work
next: Very strange problem, do you think you can help?

I couldn't find anything in the guide about a best practice on this. It seems a custom directive could be a plain old javascript file with the Vue.directive(...) syntax but I don't see a clear winner for its directory or is the best practice to simply put the registration in the default.vue layout?

Just wanting to use this in my project:

// Register a global custom directive called `v-focus`
Vue.directive('focus', {
  // When the bound element is inserted into the DOM...
  inserted: function (el) {
    // Focus the element
    el.focus()
  }
})

Thanks!

<!--cmty--><!--cmty_prevent_hook--><div align="right"><sub><em>This question is available on <a href="https://nuxtjs.cmty.io">Nuxt.js</a> community (<a href="https://nuxtjs.cmty.io/nuxt/nuxt.js/issues/c2708">#c2708</a>)</em></sub></div>