feat(Rate): count can be string

This commit is contained in:
陈嘉涵 2020-01-30 09:57:04 +08:00
parent e0cbe958a3
commit ad6087770d
3 changed files with 4 additions and 4 deletions

View File

@ -111,7 +111,7 @@ export default {
| Attribute | Description | Type | Default | | Attribute | Description | Type | Default |
|------|------|------|------| |------|------|------|------|
| v-model | Current rate | *number* | - | | v-model | Current rate | *number* | - |
| count | Count | *number* | `5` | | count | Count | *number \| string* | `5` |
| size | Icon size| *number \| string* | `20px` | | size | Icon size| *number \| string* | `20px` |
| gutter | Icon gutter | *number \| string* | `4px` | | gutter | Icon gutter | *number \| string* | `4px` |
| color | Selected color | *string* | `#ffd21e` | | color | Selected color | *string* | `#ffd21e` |

View File

@ -111,7 +111,7 @@ export default {
| 参数 | 说明 | 类型 | 默认值 | | 参数 | 说明 | 类型 | 默认值 |
|------|------|------|------| |------|------|------|------|
| v-model | 当前分值 | *number* | - | | v-model | 当前分值 | *number* | - |
| count | 图标总数 | *number* | `5` | | count | 图标总数 | *number \| string* | `5` |
| size | 图标大小,默认单位为`px` | *number \| string* | `20px` | | size | 图标大小,默认单位为`px` | *number \| string* | `20px` |
| gutter | 图标间距,默认单位为`px` | *number \| string* | `4px` | | gutter | 图标间距,默认单位为`px` | *number \| string* | `4px` |
| color | 选中时的颜色 | *string* | `#ffd21e` | | color | 选中时的颜色 | *string* | `#ffd21e` |

View File

@ -42,7 +42,7 @@ export default createComponent({
default: 'star-o', default: 'star-o',
}, },
count: { count: {
type: Number, type: [Number, String],
default: 5, default: 5,
}, },
touchable: { touchable: {
@ -146,7 +146,7 @@ export default createComponent({
const isVoid = status === 'void'; const isVoid = status === 'void';
let style; let style;
if (this.gutterWithUnit && score !== count) { if (this.gutterWithUnit && score !== +count) {
style = { paddingRight: this.gutterWithUnit }; style = { paddingRight: this.gutterWithUnit };
} }