【发布时间】:2020-07-21 14:36:17
【问题描述】:
我是材质 UI 的新手。在这里,我正在尝试创建一个样式化的组件,它将是 Typography。所以,我尝试的是,
import styled from 'styled-components';
import {
FormGroup,
FormControlLabel,
Tooltip,
FormControl,
Select,
Radio,
Typography,
Button
} from '@material-ui/core'
const StyledTypography = styled.Typography<Itest>(({ marginLeft, marginRight }) => ({
}))
但这给了我一个编译时错误。
Property 'Typography' does not exist on type 'ThemedStyledInterface<ThemeInterface>'
谁能帮我解决这个问题?
我使用了以下方式
const StyledTypography = styled(Typography)<ISortBySelector>(({ fontSize }) => ({
&& {
fontFamily: 'Roboto',
fontSize: fontSize ? fontSize : '10px',
fontWeight: 'normal',
fontStretch: 'normal',
fontStyle: 'normal',
lineHeight: 'normal',
letterSpacing: fontSize ? '0.14px' : '0.07px',
width: fontSize ? '50px' : '35px',
height: fontSize ? '19px' : '14px',
color: '#000000',
cursor: 'pointer'
}
}))
【问题讨论】:
-
是的,我已经导入了你的意思是样式对吗?
-
@keikai 我已经导入了样式,但你说的我无法理解。
-
@keikai 我也更新了导入,请检查
标签: reactjs typescript material-ui styled-components react-material