Car*_*ein 3 javascript reactjs antd
如何仅更改标题字体但保留 Ant Design 的 Card 组件子组件的默认字体?
样本卡组件:
// How to change title style
<Card title="Default" extra={<a href="#">More</a>} style={{ width: 300 }}>
<p>Card content</p>
<p>Card content</p>
<p>Card content</p>
</Card>
Run Code Online (Sandbox Code Playgroud)
titleCardAccept的属性ReactNode,因此您可以渲染任何 React 组件,特别是其样式:
import { Card, Typography } from 'antd';
const { Title } = Typography;
const App = () => (
<Card title={<Title level={2}>Custom Title</Title>}>
<p>Card Content</p>
</Card>
);
Run Code Online (Sandbox Code Playgroud)
title- 卡标题 -string|ReactNode
| 归档时间: |
|
| 查看次数: |
9204 次 |
| 最近记录: |