评分组件
效果
子组件
无
参数
rating
设置的分数.
indicator
要是 true ,则表示只读,不能进行评分.
要是 false,则表示可以进行评分.(默认就是 false)
属性
stars
星星的个数
stepSize
每次增加的分数
事件
- onChange 改变
示例
js
@Entry
@Component
struct Index10 {
@State rating: number = 3.5
build() {
Column({space:30}){
Rating({ rating: this.rating, indicator: false })
.width(200)
.height(60)
.stars(6)
.stepSize(0.5)
.onChange((value:number)=>{
this.rating = value
console.info(value.toString())
})
}
}
}