利用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成功。