Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

组件用了之后样式大了一倍 #154

Open
luoyiyi opened this issue Jan 10, 2022 · 2 comments
Open

组件用了之后样式大了一倍 #154

luoyiyi opened this issue Jan 10, 2022 · 2 comments

Comments

@luoyiyi
Copy link

luoyiyi commented Jan 10, 2022

为什么按照文档引用组件后,样式大了一倍

@zouhangwithsweet
Copy link
Member

建议配合 Rem 布局使用

htmlfontSize 设置为 13.3333vw

html {
   font-size: 13.3333vw;
}

然后将 px 转为 rem
post.config.js

module.exports = {
  plugins: {
    'postcss-pxtorem': {
      rootValue: 100,
      propWhiteList: [],
      minPixelValue: 2,
    },
    // to edit target browsers: use "browserslist" field in package.json
    autoprefixer: {},
  }
}

@zouhangwithsweet zouhangwithsweet pinned this issue Jan 11, 2022
@luoyiyi
Copy link
Author

luoyiyi commented Jan 17, 2022

建议配合 Rem 布局使用

htmlfontSize 设置为 13.3333vw

html {
   font-size: 13.3333vw;
}

然后将 px 转为 rem post.config.js

module.exports = {
  plugins: {
    'postcss-pxtorem': {
      rootValue: 100,
      propWhiteList: [],
      minPixelValue: 2,
    },
    // to edit target browsers: use "browserslist" field in package.json
    autoprefixer: {},
  }
}

因为当前项目最新要求不能使用rem,我目前解决此问题是重新定义了样式变量表进行了全局覆盖

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants