vue全局函数出现exports is not defined 全局函数:func.js
exports.install = function (Vue, options) {
Vue.prototype.mgchhq = function (){
};
Vue.prototype.mgchgl = function (data){
};
};
在main.js中引用:
import Func from './store/func.js'
Vue.use(Func);
解决exports is not defined
修改文件名即可
查看:
原因在于babel中的.babelrc文件
“modules”: false => “modules”: true,需要注意或者直接去掉
|