mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
feat(Rate): add icon-prefix prop (#5666)
This commit is contained in:
parent
130e1ac7a6
commit
05966e0469
@ -119,6 +119,7 @@ export default {
|
|||||||
| disabled-color | Disabled color | *string* | `#bdbdbd` |
|
| disabled-color | Disabled color | *string* | `#bdbdbd` |
|
||||||
| icon | Selected icon | *string* | `star` |
|
| icon | Selected icon | *string* | `star` |
|
||||||
| void-icon | Void icon | *string* | `star-o` |
|
| void-icon | Void icon | *string* | `star-o` |
|
||||||
|
| icon-prefix `v2.5.3` | Icon className prefix | *string* | `van-icon` |
|
||||||
| allow-half | Whether to allow half star | *boolean* | `false` |
|
| allow-half | Whether to allow half star | *boolean* | `false` |
|
||||||
| readonly | Whether to be readonly | *boolean* | `false` |
|
| readonly | Whether to be readonly | *boolean* | `false` |
|
||||||
| disabled | Whether to disable rate | *boolean* | `false` |
|
| disabled | Whether to disable rate | *boolean* | `false` |
|
||||||
|
@ -118,7 +118,8 @@ export default {
|
|||||||
| void-color | 未选中时的颜色 | *string* | `#c8c9cc` |
|
| void-color | 未选中时的颜色 | *string* | `#c8c9cc` |
|
||||||
| disabled-color | 禁用时的颜色 | *string* | `#bdbdbd` |
|
| disabled-color | 禁用时的颜色 | *string* | `#bdbdbd` |
|
||||||
| icon | 选中时的[图标名称](#/zh-CN/icon)或图片链接 | *string* | `star` |
|
| icon | 选中时的[图标名称](#/zh-CN/icon)或图片链接 | *string* | `star` |
|
||||||
| void-icon | 未选中时的[图标名称](#/zh-CN/icon)或图片链接 | *string* | `star-o` |
|
| void-icon | 未选中时的[图标名称](#/zh-CN/icon)或图片链接 | *string* | `star-o` |
|
||||||
|
| icon-prefix `v2.5.3` | 图标类名前缀,同 Icon 组件的 [class-prefix 属性](#/zh-CN/icon#props) | *string* | `van-icon` |
|
||||||
| allow-half | 是否允许半选 | *boolean* | `false` |
|
| allow-half | 是否允许半选 | *boolean* | `false` |
|
||||||
| readonly | 是否为只读状态 | *boolean* | `false` |
|
| readonly | 是否为只读状态 | *boolean* | `false` |
|
||||||
| disabled | 是否禁用评分 | *boolean* | `false` |
|
| disabled | 是否禁用评分 | *boolean* | `false` |
|
||||||
|
@ -34,6 +34,7 @@ export default createComponent({
|
|||||||
disabled: Boolean,
|
disabled: Boolean,
|
||||||
allowHalf: Boolean,
|
allowHalf: Boolean,
|
||||||
voidColor: String,
|
voidColor: String,
|
||||||
|
iconPrefix: String,
|
||||||
disabledColor: String,
|
disabledColor: String,
|
||||||
value: {
|
value: {
|
||||||
type: Number,
|
type: Number,
|
||||||
@ -173,8 +174,9 @@ export default createComponent({
|
|||||||
size={this.sizeWithUnit}
|
size={this.sizeWithUnit}
|
||||||
name={isFull ? icon : voidIcon}
|
name={isFull ? icon : voidIcon}
|
||||||
class={bem('icon', { disabled, full: isFull })}
|
class={bem('icon', { disabled, full: isFull })}
|
||||||
data-score={score}
|
|
||||||
color={disabled ? disabledColor : isFull ? color : voidColor}
|
color={disabled ? disabledColor : isFull ? color : voidColor}
|
||||||
|
classPrefix={this.iconPrefix}
|
||||||
|
data-score={score}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
this.select(score);
|
this.select(score);
|
||||||
}}
|
}}
|
||||||
@ -184,8 +186,9 @@ export default createComponent({
|
|||||||
size={this.sizeWithUnit}
|
size={this.sizeWithUnit}
|
||||||
name={isVoid ? voidIcon : icon}
|
name={isVoid ? voidIcon : icon}
|
||||||
class={bem('icon', ['half', { disabled, full: !isVoid }])}
|
class={bem('icon', ['half', { disabled, full: !isVoid }])}
|
||||||
data-score={score - 0.5}
|
|
||||||
color={disabled ? disabledColor : isVoid ? voidColor : color}
|
color={disabled ? disabledColor : isVoid ? voidColor : color}
|
||||||
|
classPrefix={this.iconPrefix}
|
||||||
|
data-score={score - 0.5}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
this.select(score - 0.5);
|
this.select(score - 0.5);
|
||||||
}}
|
}}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user