移动端 postcss-pxtorem插件使用

yarn add postcss-pxtorem

vue.config.js配置  
 loaderOptions: {
    postcss: {
      plugins: [
        require(‘postcss-pxtorem‘)({
          rootValue: 50, // vant用的是375设计
          propList: [‘*‘],
        })
      ]
    }
  }
 
<!-- 设置 rem 大小:1rem = 100px,使用 750px 设计稿 -->
  这里需要在public文件下的index.html 添加配置 <script> ;(function() { var f = function() { document.documentElement.style.fontSize = document.documentElement.clientWidth / 7.5 + ‘px‘ } f() window.addEventListener && window.addEventListener(‘resize‘, f, false) })() </script>

  

移动端 postcss-pxtorem插件使用

上一篇:vue之axios请求


下一篇:Python 自动化,Appium 凭什么使用 UiAutomator2?