9

vue中px转rem插件

 4 years ago
source link: https://segmentfault.com/a/1190000040396395
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

1.amfe-flexible

  • 根据网页宽度自动更改html字体大小
  • yarn add amfe-flexible -S
  • npm i amfe-flexible -S
  • main.js中引入import "amfe-flexible"

2.postcss

  • 下载yarn add postcss [email protected] -D
  • 自动将px转换为rem
  • 根目录下创建postcss.config.js文件
module.exports = {
  plugins: {
    'postcss-pxtorem': {
      rootValue: 37.5,
      propList: ['*']
    }
  }
}

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK