方法一(通过安装插件)
①npm i postcss-pxtorem @5.1.1 -D ----转rem的插件
npm i amfe-flexible -----默认是屏幕宽的1/10
②根目录创建postcss.config.js文件

③在main.js中导入 ' amfe-flexible '
方法二(通过手动计算赋值根元素字体大小---rem)

之后写单位时都用rem为单位,就不需要使用px了
①npm i postcss-pxtorem @5.1.1 -D ----转rem的插件
npm i amfe-flexible -----默认是屏幕宽的1/10
②根目录创建postcss.config.js文件
③在main.js中导入 ' amfe-flexible '
之后写单位时都用rem为单位,就不需要使用px了
本文标题:移动端实现自适应的方法
本文链接:https://www.haomeiwen.com/subject/kuozxrtx.html
网友评论