Skip to content

Rate 评分

支持平台

安卓iosweb微信小程序支付宝小程序QQ小程序
xxx

示例

html
<template>
	<t-page title="评分">
		<t-card title="评分组件" class="tdr-tdb-mltr.30"
			sub-title="灵活多变,支持自定义评分星数,设定评分下限,并提供半星评分选项,以精细反映评价。用户可通过简单的触摸滑动或鼠标拖动."></t-card>
		<introduction title="基础功能">
			<t-rate v-model="rateVal1"></t-rate>
			<t-rate v-model="rateVal2" type="success"></t-rate>
			<t-rate v-model="rateVal3" type="error"></t-rate>
			<t-rate v-model="rateVal4" type="primary"></t-rate>
			<t-rate v-model="rateVal5" type="warning"></t-rate>
		</introduction>
		<introduction title="修改颜色">
			<t-rate v-model="rateVal6" activeColor="#2979FF" inactiveColor="#55aa00"></t-rate>
		</introduction>
		<introduction title="设置大小80rpx">
			<t-rate v-model="rateVal7" class="s.80" activeColor="#2979FF"></t-rate>
		</introduction>
		<introduction title="设置间距10rpx">
			<t-rate v-model="rateVal8" activeColor="#2979FF" gutter="10rpx"></t-rate>
		</introduction>
		<introduction title="未选中星星颜色">
			<t-rate v-model="rateVal9" activeColor="#2979FF" inactiveColor="#2979FF"></t-rate>
		</introduction>
		<introduction title="最小选择3分">
			<t-rate v-model="rateVal10" activeColor="#2979FF" :minCount="3"></t-rate>
		</introduction>
		<introduction title="只读">
			<t-rate v-model="rateVal11" activeIcon="heart-fill" type="error" :readonly="true"
				inactiveIcon="heart"></t-rate>
		</introduction>
		<introduction title="禁用">
			<t-rate v-model="rateVal12" activeColor="#2979FF" :disabled="true"></t-rate>
		</introduction>
	</t-page>
</template>

<script>
	export default {
		data() {
			return {
				rateVal1: 3,
				rateVal2: 2,
				rateVal3: 1,
				rateVal4: 1,
				rateVal5: 1,
				rateVal6: 1,
				rateVal7: 1,
				rateVal8: 1,
				rateVal9: 1,
				rateVal10: 1,
				rateVal11: 1,
				rateVal12: 1,
				icon: 'star',
			};
		},
		methods: {

		}
	}
</script>

Props

名称描述类型默认值
size星星的大小String"l"
modelValue双向绑定的选中星星数量Number1
count显示的星星数量Number5
readonly是否只读Booleanfalse
inactiveColor未选中时的颜色String"#B2B2B2"
activeColor选中的颜色String""
gutter星星之间的间距,单位为pxString"15rpx"
minCount最少能选择的星星个数Number1
activeIcon选中时的图标(星星)String"star-fill"
inactiveIcon未选中时的图标(星星)String"star"

Events

名称描述
click当星星被点击时触发
update:modelValue当绑定值更新时触发
change当评分改变时触发

Methods

名称描述
reset重置评分
getValue获取当前评分