mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-26 20:20:00 +08:00
f37f471373
* feat: expand rate character * fix: demo * fix: snap * Update components/rate/index.zh-CN.md Co-authored-by: 偏右 <afc163@gmail.com> * fix Co-authored-by: 偏右 <afc163@gmail.com>
746 B
746 B
order | title | ||||
---|---|---|---|---|---|
6 |
|
zh-CN
可以使用 ({ index }) => ReactNode
的方式自定义每一个字符。
en-US
Can customize each character using ({ index }) => ReactNode
.
import { Rate } from 'antd';
import { FrownOutlined, MehOutlined, SmileOutlined } from '@ant-design/icons';
const customIcons = {
1: <FrownOutlined />,
2: <FrownOutlined />,
3: <MehOutlined />,
4: <SmileOutlined />,
5: <SmileOutlined />,
};
ReactDOM.render(
<>
<Rate
character={({ index }) => {
return index + 1;
}}
/>
<br />
<Rate
character={({ index }) => {
return customIcons[index + 1];
}}
/>
</>,
mountNode,
);