WD1X.COM - 问答一下,轻松解决,电脑应用解决专家
主板显卡CPU内存显示器
硬盘维修显卡维修显示器维修
注册表系统命令DOS命令Win8
存储光存储鼠标键盘
内存维修打印机维修
WinXPWin7Win11Linux
硬件综合机箱电源散热器手机数码
主板维修CPU维修键盘鼠标维修
Word教程Excel教程PowerPointWPS
网络工具系统工具图像工具
数据库javascript服务器
PHP教程CSS教程XML教程

vue全局函数出现exports is not defined

更新时间:2021-04-06 16:00 作者:佚名点击:
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,需要注意或者直接去掉
 

顶一下
(0)
0%
踩一下
(0)
0%
------分隔线----------------------------
你可能感兴趣的内容