mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
[improvement] Rate: add readonly prop (#1731)
This commit is contained in:
parent
ad5ca640e0
commit
3bec1de55d
@ -52,8 +52,9 @@ export default {
|
||||
| size | Icon size (px) | `Number` | `20` |
|
||||
| color | Selected color | `String` | `#ffd21e` |
|
||||
| void-color | Void color | `String` | `#c7c7c7` |
|
||||
| disabled-color | Disabled color | `String` | `#bdbdbd` |
|
||||
| readonly | Whether to be readonly | `Boolean` | `false` |
|
||||
| disabled | Whether to disable rate | `Boolean` | `false` |
|
||||
| disabled-color | Disabled color | `String` | `#bdbdbd` |
|
||||
|
||||
### Event
|
||||
|
||||
|
@ -20,14 +20,12 @@ export default create({
|
||||
name: 'rate',
|
||||
|
||||
props: {
|
||||
readonly: Boolean,
|
||||
disabled: Boolean,
|
||||
size: {
|
||||
type: Number,
|
||||
default: 20
|
||||
},
|
||||
disabled: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
color: {
|
||||
type: String,
|
||||
default: '#ffd21e'
|
||||
@ -64,7 +62,7 @@ export default create({
|
||||
|
||||
methods: {
|
||||
onSelect(index) {
|
||||
if (!this.disabled) {
|
||||
if (!this.disabled && !this.readonly) {
|
||||
this.$emit('input', index + 1);
|
||||
this.$emit('change', index + 1);
|
||||
}
|
||||
|
@ -52,8 +52,9 @@ export default {
|
||||
| size | 图标大小 (px) | `Number` | `20` |
|
||||
| color | 选中时的颜色 | `String` | `#ffd21e` |
|
||||
| void-color | 未选中时的颜色 | `String` | `#c7c7c7` |
|
||||
| disabled-color | 不可选时的颜色 | `String` | `#bdbdbd` |
|
||||
| readonly | 是否为只读状态 | `Boolean` | `false` |
|
||||
| disabled | 是否禁用评分 | `Boolean` | `false` |
|
||||
| disabled-color | 禁用时的颜色 | `String` | `#bdbdbd` |
|
||||
|
||||
### Event
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user