uni_app中main.js中的Vue.use( )的使用方法

112 阅读1分钟

举个例子: 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();

blog.csdn.net/lxiang222/a…