post-css-to-viewport兼容vant

安装完vant和post-css-to-viewport,根目录新建postcss.config.js

post-css-to-viewport兼容vant

 

const path = require('path');

module.exports = ({ file }) => {
  const designWidth = file.dirname.includes("vant") ? 375 : 750;
  return {
    plugins: {
      autoprefixer: {},
      "postcss-px-to-viewport": {
        unitToConvert: "px",
        viewportWidth: designWidth,
        unitPrecision: 6,
        propList: ["*"],
        viewportUnit: "vw",
        fontViewportUnit: "vw",
        selectorBlackList: [],
        minPixelValue: 1,
        mediaQuery: true,
        exclude: [],
        landscape: false
      }
    }
  }
}

  

 

上一篇:使用vant轮播图本地图片不显示


下一篇:vant下拉单选