
正文
vue项目中引入vant 使用rem布局问题
提示:扫一扫查出行【扫一扫了解最新限行尾号】
复制提示
postcss.config.jsconst autoprefixer = require('autoprefixer')
const pxtorem = require('postcss-pxtorem')module.exports = ({ file }) => {
let rootValue
// vant 37.5 https://github.com/youzan/vant/issues/1181
if (file && file.dirname && file.dirname.indexOf('vant') > -1) {
rootValue = 37.5
} else {
rootValue = 75
}
return {
plugins: [
autoprefixer(),
pxtorem({
rootValue: rootValue,
propList: ['*'],
minPixelValue: 2
})
]
}
}







