diff --git a/postcss.config.js b/postcss.config.js index 886a547..51da83b 100644 --- a/postcss.config.js +++ b/postcss.config.js @@ -1,9 +1,10 @@ const path = require('path'); +const unit = require('./src/config/translatedUnit_server'); module.exports = ({ file }) => { - const designWidth = file.dirname.includes(path.join('node_modules', 'vant')) ? 375 : 750; + const designWidth = file.dirname.includes(path.join('node_modules', 'vant')) ? 350 : 750; return { plugins: { autoprefixer: {}, @@ -21,7 +22,13 @@ module.exports = ({ minPixelValue: 1, // 默认值1,小于或等于1px则不进行转换 mediaQuery: true, exclude: [], - landscape: false + landscape: false, + rules: { + path: 'vant', + fn(pixels, translated) { + return `${translated * 2}${unit.vw}`; + }, + }, } } }