vue全局函数出现exports is not defined
vue全局函数出现exports is not defined全局函数:func.jsexports.install = function (Vue, options) {Vue.prototype.mgchhq = function (){};Vue.prototype.mgchgl = function (data){};};在main.js中引用:import ...
·
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,需要注意或者直接去掉
更多推荐
已为社区贡献3条内容
所有评论(0)