rating
评分条,表示用户使用感受的衡量标准条。
权限列表
无
子组件
不支持。
属性
除支持通用属性外,还支持如下属性:
样式
除支持通用样式外,还支持如下样式:
说明: star-background,star-secondary,star-foreground三个星级图源必须全部设置,否则默认的星级颜色为灰色,以此提示图源设置错误。
事件
除支持通用事件外,还支持如下事件:
方法
支持通用方法。
示例
<!-- xxx.hml -->
<div class="container">
<rating numstars="5" rating="5" @change="changeRating" id="rating">
</rating>
</div>
/* xxx.css */
.container {
display: flex;
justify-content: center;
align-items: center;
}
rating {
width: 200px;
}
// xxx.js
import prompt from '@system.prompt';
export default {
changeRating(e){
prompt.showToast({
message: e.rating
});
}
}