1.amfe-flexible
- 依据网页宽度主动更改html字体大小
yarn add amfe-flexible -S
npm i amfe-flexible -S
- main.js中引入
import "amfe-flexible"
2.postcss
- 下载
yarn add postcss postcss-pxtorem@5.1.1 -D
- 主动将px转换为rem
- 根目录下创立postcss.config.js文件
module.exports = { plugins: { 'postcss-pxtorem': { rootValue: 37.5, propList: ['*'] } }}