[new feature] Rate: add allow-half prop (#3134)

This commit is contained in:
neverland
2019-04-11 17:14:34 +08:00
committed by GitHub
parent e6d4f331a8
commit 9ecbcae725
7 changed files with 314 additions and 74 deletions
+37 -3
View File
@@ -41,18 +41,51 @@ export default {
<van-rate
v-model="value"
:size="25"
:count="6"
color="#07c160"
void-color="#ceefe8"
color="#f44"
void-icon="star"
void-color="#eee"
/>
```
#### Half Star
```html
<van-rate
v-model="value"
allow-half
void-icon="star"
void-color="#eee"
/>
```
```javascript
export default {
data() {
return {
value: 2.5
};
}
}
```
#### Custom Count
```html
<van-rate v-model="value" :count="6" />
```
#### Disabled
```html
<van-rate v-model="value" disabled />
```
#### Readonly
```html
<van-rate v-model="value" readonly />
```
### API
| Attribute | Description | Type | Default |
@@ -64,6 +97,7 @@ export default {
| void-color | Void color | `String` | `#c7c7c7` |
| icon | Selected icon | `String` | `star` |
| void-icon | Void icon | `String` | `star-o` |
| allow-half | Whether to allow half star | `Boolean` | `false` |
| readonly | Whether to be readonly | `Boolean` | `false` |
| disabled | Whether to disable rate | `Boolean` | `false` |
| disabled-color | Disabled color | `String` | `#bdbdbd` |