在vue-cli3中使用 amfe-flexible 和 px2rem-loader


安装 amfe-flexible 

cnpm install amfe-flexible -S

 

安装 px2rem-loader 

cnpm install px2rem-loader -D

 

在mian.js中引入 

import 'amfe-flexible'

 

在vue.config.js中配置

module.exports = {
    chainWebpack: config => {
        config.module
            .rule('scss')
            .test(/\.scss$/)
            .oneOf('vue')
            .use('px2rem-loader')
            .loader('px2rem-loader')
            .before('postcss-loader') // this makes it work.
            .options({ remUnit: 75, remPrecision: 8 })
            .end()
    }
}

重新启动脚手架

px2rem-loader


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM