基于-styledcomponents-的单位-px-vw-自动转换

在 styled-components 基础上实现了 px -> vw 单位转换的功能

详细文档请参考: styled-components.com/docs

源码地址:https://github.com/hnzycfcfed/styled-px2vw

示例

Output

Screenshot

迁移

只需要修改 styled-components -> styled-px2vw 的导入即可

import styled, { createGlobalStyle,... } from 'styled-components';

const Button = styled.button`
  color: white;
  font-size: 36px;
  margin: 10px;
  height: 85px;
  border: 2px solid palevioletred;
  border-radius: 3px;
`;

to

import styled, { createGlobalStyle,... } from 'styled-px2vw';

const Button = styled.button`
  color: white;
  font-size: 36px;
  margin: 10px;
  height: 85px;
  border: 2px solid palevioletred;
  border-radius: 3px;
`;

评论

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

这个站点使用 Akismet 来减少垃圾评论。了解你的评论数据如何被处理