yarn add styled-components
import styled from 'styled-components'
1、基础使用
const BoxStyle = styled.div`
color: red;
`
2、UI组件加样式
import { Button } from 'antd'
const BtnStyle = styled(Button)`
font-size: 16px;
`
3、动态传参数
<MainStyle wit={200} hit={1}></MainStyle>
const MainStyle = styled.div<{ wit: number, hit: number }>`
width: ${props => props.wit}px;
height: ${props => props.hit === 1 ? 300 : 600}px;
`