插件
js
MyPlugin.install = function(Vue, options) {
// 全局注册组件 (指令等功能资源类似)
Vue.component('component-name', {
// 组件内容
})
// 添加实例方法
Vue.prototype.$Notice = function() {
// 逻辑
}
// 添加全局方法或属性
Vue.globalMethod = function() {
// 逻辑
}
// 添加全局混合
Vue.mixin({
mounted() {
// 逻辑
}
})
}
// 通过Vue.use()来使用插件
//Vue.use(MyPlugin)
Vue.use(MyPlugin, {
// 参数
})