举个例子: main.js文件 import aa from "aa"; Vue.use(aa);
node_modules/aa/index.js
export default {
constructor() {
this.install();
},
bb() {
console.log(好人的了吧);
},
install(Vue) {
Vue.prototype.$aa = this;
}
}
然后就可以在任意的vue文件中使用了 this.$aa.bb();
举个例子: main.js文件 import aa from "aa"; Vue.use(aa);
node_modules/aa/index.js
export default {
constructor() {
this.install();
},
bb() {
console.log(好人的了吧);
},
install(Vue) {
Vue.prototype.$aa = this;
}
}
然后就可以在任意的vue文件中使用了 this.$aa.bb();