vant 组件在使用flexible和postcss-pxtorem下字体变小的问题

751 阅读1分钟

这里使用的是postcss-pxtorem

在根目录下的 postcssrc.js文件下加入如下代码

module.exports = ({ file }) => {
  let isVant = file && file.dirname && file.dirname.indexOf("vant") > -1;
  let rootValue = isVant ? 37.5 : 37.5; // 判断条件 请自行调整
  return {
    plugins: {
      autoprefixer: {},
      "postcss-pxtorem": {
        rootValue: rootValue,
        propList: ["*"],
      },
    },
  };
};

测试成功