Skip to content

RatingControl-DEMO


vue
<fv-RatingControl value="3">
</fv-RatingControl>

RatingControl-Half Rate


vue
<fv-RatingControl value="2.5" :halfRate="true">
</fv-RatingControl>

with Hover Title

2.5

vue
<fv-RatingControl v-model="value" :halfRate="true" @hover="hoverValue">
</fv-RatingControl>

<script>
export default {

    data () {
        return {
            value: 2.5
        }
    },
    methods: {
        hoverValue (target) {
            this.value = target.index + (target.ratio > 50 ? 0.5 : 0);
        }
    }
}
</script>

RatingControl-Clearable


vue
<fv-RatingControl value="2.5" :halfRate="true" :isClear="true">
</fv-RatingControl>

RatingControl-Readonly


vue
<fv-RatingControl value="3.5" :halfRate="true" :isClear="true" readonly>
</fv-RatingControl>

RatingControl-Customize


vue
<fv-RatingControl value="1.5" defaultIcon="Heart" selectedIcon="HeartFill" borderColor="rgba(200, 200, 200, 1)" selectedColor="rgba(173, 38, 45, 1)" :halfRate="true" :isClear="true">
</fv-RatingControl>

属性


属性类型必填默认值说明
modelValuenumber0分值。
maxRatenumber5最大值。
halfRatebooleanfalse是否允许半分。
defaultIconstring'FavoriteStar'默认图标。
selectedIconstring'FavoriteStarFill'选中图标。
borderColorstring''边框颜色。
selectedColorstring''选中颜色。
isClearbooleanfalse是否允许清除。
readonlybooleanfalse只读。
themestring'global'主题色。
disabledbooleanfalse参见组件的 disabled 选项。
langstring"global"参见组件的 lang 选项。

事件


事件名参数说明
changeNumber分值改变时触发。
hoverObject鼠标悬浮时触发。
leaveNumber鼠标离开时触发。

MIT Licensed