vue项目使用mint-ui库
生活随笔
收集整理的這篇文章主要介紹了
vue项目使用mint-ui库
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
(1)使用低版本core2不要是用core3
npm install --save core-js@2 或者 ( yarn add core-js@2)如果使用core3 項目會以為版本太高報錯npm install --save core-js@3 或者 ( yarn add core-js@3)babel 需要升級到7.0以上,babel-core在6.0以上
(2)報錯一
vue-eslint-parser@5.0.0 requires a peer of eslint@^5.0.0 but none is installed. You must install peer dependencies yourself要求你裝一個大于等于5.0.0版本,并且小于4.0.0的eslint,那么顯然如果安裝了 “eslint-plugin-vue”: “^5.2.3” 更高版本,
你裝的eslint不符合這個要求。其他插件的警告同理。
(3)報錯二
babel-loader@7.1.5 requires a peer of babel-core@6 but none is installed. You must install peer dependencies yourself要求你裝一個大于等于6.0.0版本,并且小于7.1.5 的babel-core, 現在安裝了eslint"babel-loader": "^7.1.5"則會報警告
(4)配置 mini-ui 按需加載
1.官網的按需加載,多寫了一個[ ]報錯 一定要去掉
2.需要安裝babel-plugin-component 插件
npm地址: https://www.npmjs.com/package/babel-plugin-component
npm install babel-plugin-component -D3.在.babelrc中正確寫法
{"presets": ["@babel/preset-env", "@babel/preset-react"],"plugins": ["@babel/plugin-transform-runtime", "@babel/plugin-proposal-object-rest-spread","@babel/plugin-proposal-class-properties", ["component", {"libraryName": "mint-ui","style": true}]] }(5)報錯三
Error: .plugins[4][1] must be an object, false, or undefined因為.plugins 中的mini-ui 按需加載 報錯
(6)入口文件 引入 import 'mint-ui/lib/style.css' 無法生效
處理方案:單頁根路徑,新建style.ccss ,然后 style中通過import的方式引入 node_module中的文件
@import '~mint-ui/lib/style.css';演示:
總結
以上是生活随笔為你收集整理的vue项目使用mint-ui库的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 三星在韩国推出 89 英寸 Micro
- 下一篇: 曝华为Mate60系列发布会延期 &ld