【问题标题】:Emotion not overriding Material UI defaults情感不会覆盖 Material UI 默认值
【发布时间】:2021-05-19 01:52:52
【问题描述】:

我正在尝试使用以下内容来设置 MaterialUI Typography 组件的样式:

const StyledTitleTypography = styled(Typography)`
  color: 'black';
  font-weight: 'bold';
`;

<StyledTitleTypography variant="h6" noWrap>
    test
</StyledTitleTypography>

产生这个:

但是,当我直接设置样式时,它可以工作

<Typography variant="h6" noWrap style={{ color: 'black', fontWeight: 'bold' }}>
    test
</Typography>

产生这个:

如果有人在外面...here'semotionstyled-components 一起演示的堆栈闪电

【问题讨论】:

    标签: css reactjs material-ui styled-components emotion


    【解决方案1】:

    太傻了...从内联样式中复制了引号...

    const StyledTitleTypography = styled(Typography)`
      color: black;
      font-weight: bold;
    `;
    

    作品

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-12-20
      • 1970-01-01
      • 2013-10-23
      • 2021-10-16
      • 1970-01-01
      • 1970-01-01
      • 2021-01-23
      • 2011-12-20
      相关资源
      最近更新 更多