Rate 评分
评分组件可配合表单组件c-form使用。
平台
| App | 小程序 | H5 |
|---|---|---|
| √ | √ | √ |
属性
| 属性名 | 类型 | 默认值 | 说明 | 平台 |
|---|---|---|---|---|
| modelValue | Number,String | All | ||
| count | String,Number | 5 | 星星的数量 | All |
| itemScore | String,Number | 1 | 每项分数 | All |
| color | String | c-t-placeholder | 颜色 | All |
| activeColor | String | c-t-warning | All | |
| half | Boolean | false | 是否展示半星,半个0.5分 | All |
| size | String,Number | 64rpx | 星星的大小 | All |
| gutter | String,Number | 12rpx | 星星之间的距离 | All |
| inactiveIcon | String | star | 未选中的图标 | All |
| activeIcon | String | star-fill | 选中的图标 | All |
| readonly | Boolean | false | 是否为只读状态 | All |
| disabled | Boolean | false | 是否为禁用状态 | All |
| disabledColor | String | null | 颜色 | All |
| disabledActiveColor | String | c-t-secondary | All | |
| cClass | String,Array,Object | null | 组件类 | All |
| cStyle | String,Array,Object | null | 组件样式 | All |
| margin | String,Number,Array | null | 外边距 | All |
| padding | String,Number,Array | null | 内边距 | All |
| bgColor | String | null | 背景色,支持c-bg-开头的背景色类 | All |
事件
| 事件名 | 说明 |
|---|---|
| update:modelValue | |
| change | value |
插槽
| 插槽名 | 说明 |
|---|---|
| inactiveIcon | 默认图标插槽,props值color,size,disabled,disabledColor,itemNum |
| activeIcon | 激活图标插槽,props值color,size,disabled,disabledColor,itemNum |
| default |
注意
微信小程序下使用带props的插槽时,需要显试写出<template #default="slotProps">,否则会报错。
示例
vue
<template>
<c-rate modelValue="4" readonly />
</template>1
2
3
2
3
