2016-03-31 14:17:09 +08:00
|
|
|
---
|
|
|
|
category: Components
|
2016-07-21 10:10:04 +08:00
|
|
|
subtitle: 评分
|
2018-11-04 16:20:35 +08:00
|
|
|
type: 数据录入
|
2016-07-21 10:10:04 +08:00
|
|
|
title: Rate
|
2020-06-05 13:50:09 +08:00
|
|
|
cover: https://gw.alipayobjects.com/zos/alicdn/R5uiIWmxe/Rate.svg
|
2016-03-31 14:17:09 +08:00
|
|
|
---
|
2016-03-30 13:20:03 +08:00
|
|
|
|
|
|
|
评分组件。
|
|
|
|
|
2016-03-31 14:43:38 +08:00
|
|
|
## 何时使用
|
|
|
|
|
|
|
|
- 对评价进行展示。
|
2016-04-05 19:14:21 +08:00
|
|
|
- 对事物进行快速的评级操作。
|
2016-03-30 13:20:03 +08:00
|
|
|
|
2016-03-31 14:43:38 +08:00
|
|
|
## API
|
2016-03-30 13:20:03 +08:00
|
|
|
|
2020-04-28 16:46:50 +08:00
|
|
|
| 属性 | 说明 | 类型 | 默认值 |
|
|
|
|
| --- | --- | --- | --- |
|
|
|
|
| allowClear | 是否允许再次点击后清除 | boolean | true |
|
|
|
|
| allowHalf | 是否允许半选 | boolean | false |
|
|
|
|
| autoFocus | 自动获取焦点 | boolean | false |
|
2020-05-28 15:19:15 +08:00
|
|
|
| character | 自定义字符 | ReactNode | [`<StarFilled />`](/components/icon/) |
|
2020-04-28 16:46:50 +08:00
|
|
|
| className | 自定义样式类名 | string | |
|
|
|
|
| count | star 总数 | number | 5 |
|
|
|
|
| defaultValue | 默认值 | number | 0 |
|
|
|
|
| disabled | 只读,无法进行交互 | boolean | false |
|
|
|
|
| style | 自定义样式对象 | CSSProperties | |
|
|
|
|
| tooltips | 自定义每项的提示信息 | string\[] | |
|
|
|
|
| value | 当前数,受控值 | number | |
|
|
|
|
| onBlur | 失去焦点时的回调 | Function() | |
|
|
|
|
| onChange | 选择时的回调 | Function(value: number) | |
|
|
|
|
| onFocus | 获取焦点时的回调 | Function() | |
|
|
|
|
| onHoverChange | 鼠标经过时数值变化的回调 | Function(value: number) | |
|
|
|
|
| onKeyDown | 按键回调 | Function(event) | |
|
2017-12-01 19:28:41 +08:00
|
|
|
|
|
|
|
## 方法
|
|
|
|
|
2019-11-22 14:37:39 +08:00
|
|
|
| 名称 | 描述 |
|
|
|
|
| ------- | -------- |
|
|
|
|
| blur() | 移除焦点 |
|
|
|
|
| focus() | 获取焦点 |
|