# uni-rate ## Instructions 组件名:uni-rate 代码块: uRate 关联组件: uni-icons 点击下载&安装 ### Syntax - 使用 ``(或 ``,当需要包裹子节点时)。 - 遇到平台差异时,建议使用条件编译(`#ifdef / #endif`)显式处理。 #### Properties | 属性名 | 类型 | 默认值 | 说明 | | --- | --- | --- | --- | | value/v-model | Number | 0 | 当前评分 | | color | String | #ececec | 未选中状态的星星颜色 | | activeColor | String | #ffca3e | 选中状态的星星颜色 | | disabledColor | String | #c0c0c0 | 禁用状态的星星颜色 | | size | Number | 24 | 星星的大小 | | max | Number | 5 | 最大评分评分数量,目前一分一颗星 | | margin | Number | 0 | 星星的间距,单位 px | | isFill | Boolean | true | 星星的类型,是否为实心类型 | | disabled | Boolean | false | 是否为禁用状态 (之前版本为已读状态,现更正为禁用状态) | | readonly | Boolean | false | 是否为只读状态 | | allowHalf | Boolean | false | 是否展示半星 | | touchable | Boolean | true | 是否支持滑动手势 | #### Events | 事件称名 | 说明 | 返回参数 | | --- | --- | --- | | @change | 改变 value 的值返回 | e = { value:number } | #### Platform Compatibility See official docs for platform support table: `https://uniapp.dcloud.net.cn/component/uniui/uni-rate.html` ### Examples ### Example (Example 1) ```vue ``` ### Example (Example 2) ```html ``` ### Example (Example 3) ```vue export default { components: {}, data() { return { value: 2 } }, methods: { onChange(e) { console.log('rate发生改变:' + JSON.stringify(e)) } } } ``` ### Example (Example 4) ```javascript export default { components: {}, data() { return { value: 2 } }, methods: { onChange(e) { console.log('rate发生改变:' + JSON.stringify(e)) } } } ``` ### Example (Example 5) ```vue ``` ### Example (Example 6) ```html ``` Reference: - [Official Documentation](https://uniapp.dcloud.net.cn/component/uniui/uni-rate.html) - [Plugin Marketplace](https://ext.dcloud.net.cn/plugin?name=rate) - [Local Example](examples/uni-ui/uni-rate.vue)