mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-25 10:56:35 +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` |
|
| size | Icon size (px) | `Number` | `20` |
|
||||||
| color | Selected color | `String` | `#ffd21e` |
|
| color | Selected color | `String` | `#ffd21e` |
|
||||||
| void-color | Void color | `String` | `#c7c7c7` |
|
| 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 | Whether to disable rate | `Boolean` | `false` |
|
||||||
|
| disabled-color | Disabled color | `String` | `#bdbdbd` |
|
||||||
|
|
||||||
### Event
|
### Event
|
||||||
|
|
||||||
|
@ -20,14 +20,12 @@ export default create({
|
|||||||
name: 'rate',
|
name: 'rate',
|
||||||
|
|
||||||
props: {
|
props: {
|
||||||
|
readonly: Boolean,
|
||||||
|
disabled: Boolean,
|
||||||
size: {
|
size: {
|
||||||
type: Number,
|
type: Number,
|
||||||
default: 20
|
default: 20
|
||||||
},
|
},
|
||||||
disabled: {
|
|
||||||
type: Boolean,
|
|
||||||
default: false
|
|
||||||
},
|
|
||||||
color: {
|
color: {
|
||||||
type: String,
|
type: String,
|
||||||
default: '#ffd21e'
|
default: '#ffd21e'
|
||||||
@ -64,7 +62,7 @@ export default create({
|
|||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
onSelect(index) {
|
onSelect(index) {
|
||||||
if (!this.disabled) {
|
if (!this.disabled && !this.readonly) {
|
||||||
this.$emit('input', index + 1);
|
this.$emit('input', index + 1);
|
||||||
this.$emit('change', index + 1);
|
this.$emit('change', index + 1);
|
||||||
}
|
}
|
||||||
|
@ -52,8 +52,9 @@ export default {
|
|||||||
| size | 图标大小 (px) | `Number` | `20` |
|
| size | 图标大小 (px) | `Number` | `20` |
|
||||||
| color | 选中时的颜色 | `String` | `#ffd21e` |
|
| color | 选中时的颜色 | `String` | `#ffd21e` |
|
||||||
| void-color | 未选中时的颜色 | `String` | `#c7c7c7` |
|
| void-color | 未选中时的颜色 | `String` | `#c7c7c7` |
|
||||||
| disabled-color | 不可选时的颜色 | `String` | `#bdbdbd` |
|
| readonly | 是否为只读状态 | `Boolean` | `false` |
|
||||||
| disabled | 是否禁用评分 | `Boolean` | `false` |
|
| disabled | 是否禁用评分 | `Boolean` | `false` |
|
||||||
|
| disabled-color | 禁用时的颜色 | `String` | `#bdbdbd` |
|
||||||
|
|
||||||
### Event
|
### Event
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user