欢迎来到尧图网

客户服务 关于我们

您的位置:首页 > 文旅 > 明星 > AntDesignVue Rate 评分 实现五星好评功能

AntDesignVue Rate 评分 实现五星好评功能

2024/10/24 7:26:23 来源:https://blog.csdn.net/qq_37703224/article/details/139765839  浏览:    关键词:AntDesignVue Rate 评分 实现五星好评功能

案例:基本用法

<script setup>
import {ref} from "vue";const value = ref()
</script>
<template><div class="p-8 bg-red-300 text-center"><a-rate v-model:value="value"/><a-divider/>{{ value }}</div>
</template>

案例:半颗星

核心:allow-half

支持给出四星半,三星半之类的半颗星的评价。

<script setup>
import {ref} from "vue";const value = ref()
</script>
<template><div class="p-8 bg-red-300 text-center"><a-rate v-model:value="value" allow-half/><a-divider/>{{ value }}</div>
</template>

案例:评价等级

核心::tooltips="desc"

<script setup>
import {ref} from "vue";const value = ref()
const desc = ref(["差评", "较差", "一般", "较好", "好评"])
</script>
<template><div class="p-8 bg-red-300 text-center"><a-rate v-model:value="value" :tooltips="desc"/><span class="ant-rate-text">{{ desc[value - 1]}}</span><a-divider/>{{ value }}</div>
</template>

案例:只读

核心:disabled

<template><a-rate :value="2" disabled />
</template>

案例:其他字符

<template><div><a-rate v-model:value="value1" allow-half><template #character><heart-outlined /></template></a-rate><br /><a-rate v-model:value="value2" character="A" allow-half style="font-size: 36px" /><br /><a-rate v-model:value="value3" character="" allow-half /><br /></div>
</template>
<script setup>
import { ref } from 'vue';
const value1 = ref(2);
const value2 = ref(2.5);
const value3 = ref(0.5);
</script>

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com