0
点赞
收藏
分享

微信扫一扫

H5移动端适配神器(lib-flexible)

素的盐 2022-04-18 阅读 76
vue.js前端

移动端适配Rem是主流,推荐使用淘宝团队维护的: lib-flexible

cnpm i lib-flexible -S

cnpm i postcss-pxtorem postcss-loader -D

1. main.js 下引入

import 'lib-flexible/flexible.js'

2. vue.config.js同级目录下新建: postcss.config.js

module.exports = {
  plugins: {
    autoprefixer: {
      overrideBrowserslist: [
        'Android 4.1',
        'iOS 7.1',
        'Chrome > 31',
        'ff > 31',
        'ie >= 8'
      ]
    },
    'postcss-pxtorem': {
      rootValue: 37.5,
      propList: ['*']
    }
  }
}
举报

相关推荐

0 条评论