首页 > 移动平台 > 详细

移动端 postcss-pxtorem插件使用

时间:2020-12-02 14:19:05      阅读:65      评论:0      收藏:0      [点我收藏+]

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插件使用

原文:https://www.cnblogs.com/Alitar/p/14073482.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!