先安装 npm i postcss-px-to-viewport -D

然后vue.config.js中进行以下配置
module.exports = { css:{ loaderOptions:{ css:{}, postcss:{ plugins:[ require("postcss-px-to-viewport")({ unitToConvert: 'px', viewportWidth: 375, unitPrecision: 5, propList: ['*'], viewportUnit: 'vw', fontViewportUnit: 'vw', selectorBlackList: ['wrap'], minPixelValue: 1, mediaQuery: false, replace: true, exclude: undefined, include: undefined, landscape: false, landscapeUnit: 'vw', landscapeWidth: 667 }) ] } } } }

  

posted on 2021-01-27 11:33  你这个梦,有点大  阅读(279)  评论(0编辑  收藏  举报