版本

postcss@7.0.0和postcss-pxtorem@5.1.1版本兼容

在post.config.js中配置

  1. module.exports = {
  2. plugins: {
  3. "postcss-pxtorem": {
  4. "rootValue": 37.5,
  5. "propList": ["*"]
  6. }
  7. }
  8. }

在vue.config.js中配置

module.exports = {
    lintOnSave: false,
    css: {
        loaderOptions: {
            postcss: {
                    plugins:[
                        require("postcss-pxtorem")({
                            "rootValue": 37.5,
                            "propList": ["*"]
                        })
                    ]
                }
        }
    }
}