【发布时间】:2020-08-02 09:07:34
【问题描述】:
我使用的是这个材质的 ui 按钮,它有一个紫色的背景
<Button
component={Link}
to={link}
style={{
background: '#6c74cc',
borderRadius: 3,
border: 0,
color: 'white',
height: 48,
padding: '0 30px',
width: 200,
}}>
我尝试将其更改为样式组件:
export const StyledButton = styled(Button)`
background: #6c74cc;
border-radius: 3;
border: 0;
color: white;
height: 48;
padding: 0 30px;
width: 200px;
`;
但它看起来完全不同。背景为白色,文本为黑色。即使我正在应用相同的样式。宽度也不同。我该如何解决这个问题?
https://codesandbox.io/s/condescending-frost-muv1s?file=/src/App.js
【问题讨论】:
标签: javascript css reactjs typescript styled-components