Mobile adaptation: REM + Flex

Postcss – PxtoREM is a PostCSS plugin for converting units to REM

Lib-flexible Specifies the REM reference value

$ npm postcss-pxtorem –save-dev

We also need to configure a.postcsrc. Js file in the vue scaffold root directory

module.exports = {
  plugins: {
    // Scaffolding is configured
    / * autoprefixer: {browsers: [" Android > = 4.0 ", "iOS > = 8"]}, * /
    "postcss-pxtorem": {
      rootValue({ file }) {
        // A vant value of 37.5 exists if it is not equal to -1
        return file.indexOf("vant")! = = -1 ? 37.5 : 75;
      },
      propList: ["*"]
      // Configure style resources that do not convert
      // exclude: "github-markdown"}}}; QWQ self-usedCopy the code