[improvement] Rate: add readonly prop (#1731)

This commit is contained in:
neverland 2018-08-30 21:27:10 +08:00 committed by GitHub
parent ad5ca640e0
commit 3bec1de55d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 7 deletions

View File

@ -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

View File

@ -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);
}

View File

@ -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