vant 中使用 rem
安装插件
postcss-pxtorem
lib-flexible
安装命令
npm install postcss-pxtorem --save-dev
npm i -S amfe-flexible
然后创建 postcss.config.js 文件 将下面代码赋值进去
module.exports = {
plugins: {
'autoprefixer': {
browsers: ['Android >= 4.0', 'iOS >= 7']
},
'postcss-pxtorem': {
rootValue: 37.5,
propList: ['*']
}
}
}
本文详细介绍如何在Vant UI框架中使用REM单位进行响应式布局。通过安装postcss-pxtorem和lib-flexible插件,并配置postcss.config.js文件,实现从像素到REM的转换,确保页面在不同设备上的适配性和一致性。
632

被折叠的 条评论
为什么被折叠?



