搜索文档
amfe-flexible
作用:根据网页宽度,设置 html 的 font-size。
安装
shnpm i amfe-flexible引入(main.js)
javascriptimport "amfe-flexible"
postcss
作用:用于处理 css,编译 css 代码。
安装
shnpm i postcss
postcss-pxtorem
作用:用于把 css 代码里所有 px 转为 rem。
安装
shnpm i postcss-pxtorem@5.1.1在根目录中创建 postcss 配置文件 postcss.config.js
javascriptmodule.exports = { plugins: { 'postcss-pxtorem': { rootValue: 37.5, propList: ['*'] } } }rootValue 由原型尺寸决定,通常情况下原型的宽度是 375px,rootValue 的值为原型宽度的十分之一。
