h5移动端适配(px->vw/vh)

vw适配

1.browserslistrc文件

删除 not dead

2. 安装依赖

cnpm i -S postcss-px-to-viewport

3.根目录下创建

postcss.config.js 文件
配置如下:

module.exports = {
     
    "plugins": {
     
        "postcss-px-to-viewport": {
     
          "unitToConvert": "px", 
          "viewportWidth": 375, 
          "viewportHeight": 667, 
          "unitPrecision": 3, 
          "propList": ["*"], 
          "viewportUnit": "vw", 
          "fontViewportUnit": "vw", 
          "selectorBlaskList": [".ignore-"], 
          "mediaQuery": false, 
          "minPixelValue": 1, 
          "replace": true, 
          "exclude": [], 
          "landscape": false, 
          "landscapeUnit": "vw", 
          "landscapeWidth": 1134
        }
      }
}

你可能感兴趣的:(vue,插件,h5,前端)