vue+webpack项目中引入MUI所碰见的问题

利用webpack搭建的Vue多页应用中,引入mui过程中碰见若干问题,记录如下:

mui引入

当前未发现npm的方式导入。到官网https://github.com/dcloudio/mui 下载zip文件;

加压,应用dist目录到自己的项目中;

在main.js中引入:

 使用方式:

this.mui.toast("mui test");

问题1:npm run build 报错:Error: postcss-svgo: Error in parsing SVG: Unquoted attribute value

百度一圈:都说是单引用变成双引用,可是我这里还是报错:

但下面的改法成功build OK

在background-image 内部对<svg>标签进行双引号引用,使用“\”转义。

问题2:Uncaught TypeError: 'caller', 'callee', and 'arguments' properties may not be accessed on strict mode functions or the arguments objects for calls to them at...

webpack 启用js 严格模式,去除严格模式即可:

具体做法:

npm install babel-plugin-transform-remove-strict-mode

在工程中手动添加.babelrc文件,windows下 新建文本文件,重命名为.babelrc. 

在上面文件中添加如下配置:

{
  "plugins": ["transform-remove-strict-mode"]
}

至此,引用MUI成功。

发布了92 篇原创文章 · 获赞 55 · 访问量 24万+

猜你喜欢

转载自blog.csdn.net/elie_yang/article/details/102641205
今日推荐