移动端vant rem适配

在使用vant UI时候,由于是在移动端开发 所以需要使用rem为单位,而vant里面的组件默认是px单位,就需要用到官网提供的两个插件。

具体配置参看这位老哥的:https://www.jianshu.com/p/b0902e3d4aeb

配置完之后在开发中就可以使用px单位了,它会自动转化为rem。

复制代码
"postcss": {
    "plugins": {
      "autoprefixer": {
        "overrideBrowserslist": [
          "Android 4.1",
          "iOS 7.1"
        ]
      },
      "postcss-pxtorem": {
        "rootValue": 37.5,
        "propList": [
          "*"
        ]
      }
    }
  },

猜你喜欢

转载自www.cnblogs.com/zzhqdkf/p/12445404.html