vue cli3移动端 中使用rem配置 以及适配方案!

转载自https://blog.csdn.net/qq_42957741/article/details/102392491

第一步 安装

npm  add postcss-px2rem

第二步

在 vue.config.js 中添加配置

const px2rem = require('postcss-px2rem')

const postcss = px2rem({
  remUnit: 32   //基准大小 baseSize,需要和rem.js中相同
})

module.exports = {
  css: {
    loaderOptions: {
      postcss: {
        plugins: [
          postcss
        ]
      }
    }
  }
}

第三步 index.html中


你可能感兴趣的:(vue cli3移动端 中使用rem配置 以及适配方案!)