在vue中,postcss-pxtorem的rootValue为37.5,那么px to rem这个工具Root Font Size该填多少


module.exports = {
   plugins: {
     'postcss-pxtorem': {
       // 能够把所有元素的px单位转成Rem
       // rootValue: 转换px的基准值。
       // 编码时, 一个元素宽是75px,则换成rem之后就是2rem
       rootValue: 37.5,
       propList: ['*']
     }
   }
 }

img

postcss-pxtorem会将你项目中的px转为rem,所以在开发中不必使用px to rem工具,px to rem只能设置整数,按道理来讲,如果要用需要配置37.5

如果是使用了vant,也可以两者都更改成75,px to rem就可以用整数了,https://vant-contrib.gitee.io/vant/v2/#/zh-CN/advanced-usage#qi-ta-she-ji-gao-chi-cun

可以参考我的 :rootValue:192 Root Font Size: 108