The official demo

Github.com/youzan/vant…

package.json

yarn add autoprefixer -D
yarn add postcss-pxtorem -D
yarn add amfe-flexible -D
Copy the code

vue.config.js

const autoprefixer = require('autoprefixer'); const pxtorem = require('postcss-pxtorem'); module.exports = { outputDir: 'dist', publicPath: process.env.NODE_ENV === 'production' ? '/ ant-demo/' : '/', CSS: {loaderOptions: {postcss: {plugins: [autoprefixer(), pxtorem({rootValue: 37.5, propList: ['*']})]}}}};Copy the code

main.js

import 'amfe-flexible';
Copy the code

Pay attention to

The postCSS-pxtorem version v6 in package.json is different from V5. The above Settings apply only to V5

"Postcss - pxtorem" : "~ 5.0.0",Copy the code