在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