# 移动端适配方案

# 移动端 rem 适配及 UI 框架 px to rem

yarn add amfe-flexible -S

yarn add postcss-pxtorem -D

// main.js
import 'amfe-flexible'
1
2
// postcss.config.js
const autoprefixer = require('autoprefixer');
const pxtorem = require('postcss-pxtorem');
module.exports = () => {
    return {
        plugins: [
            autoprefixer(),
            pxtorem({
              rootValue: 75,
              // propList: ['*']
            })
        ]
    }
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14