plugin

Estimated reading time: 1 minute

add vue plugin

  • Vue.use(name)
Vue.use(pluginName, {
  someOption: true
})

create plugin

const pluginName = {
  install(Vue, options = {}) {
    if (this.installed) {
      return
    }
    this.installed = true
    // plugin code

  }
}
// automatic plugin add
if (typeof window !== 'undefined' && window.Vue) {
  window.Vue.use(pluginName);
}

export default pluginName

resoures

vue, vusjs