[Vuejs]-Nuxt ignores use own plugin

0๐Ÿ‘

โœ…

I tried to call my example plugin, and it works, but property this.$a was hidden.

But if you want to correctly registration: in some module, i found this registration, and it works!

Vue.use({
  install(Vue, options = {}) {
    Object.defineProperty(Vue.prototype, '$a', {
      get() {
        return (...data) => console.log(...data);
      }
    });
  }
});

0๐Ÿ‘

You need the add โ€˜.jsโ€™ to your reference in the plugins key.


plugins: [ '~/plugins/myplugin.js ' ],

Leave a comment