vue项目使用mui

vue使用mui

mui github 链接:https://github.com/dcloudio/mui

​ 下载mui后将起文件dist下的文件复制到vue项目static下新建mui文件目录

img

​ 再main.js中

// // 引入mui组件
import mui from '../static/mui/js/mui.js'
Vue.prototype.mui = mui
//引入其样式
import "../static/mui/css/mui.css";

再使用mui组件的时候要通过this来访问

  • 列子 轮播图初始化
 	var gallery = this.mui('.mui-slider');
      gallery.slider({
        interval:1000//自动轮播周期,若为0则不自动播放,默认为0;
      });

最后有一点 打包的时候因为mui.css 的svg问题 会出现以下报错

building for production...Error processing file: static/css/app.316977a049dccd7ae4089d9226e81a34.css
(node:11888) UnhandledPromiseRejectionWarning: postcss-svgo: Error in parsing SVG: Unquoted attribute value
Line: 0
Column: 14
Char: \
(node:11888) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 3)
(node:11888) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

​ 解决方法 ctrl+f 做出svg 然后将起src最外层的单引号换成双引号

修改成双引号

  • mui.css 和mui.mim.css都要修改 或者你可以选择删掉一个 QAQ

最后 npm run build 就OK啦

img

​ 关于打包后的路劲问题

img

​ 去config下的index.js中 的build下的assetsPublicPath换成./

img

​ 关于字体图标打包后无法显示

需要找到webpack.base.conf.js 文件把之前的默认的处理tff文件的中的tff删掉,新增一条:{ test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/, use: 'url-loader' },

img

​ 到此打包后的文件应该是没有问题了

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值