fix:打分bug修改

This commit is contained in:
du.meimei
2025-03-05 19:27:43 +08:00
parent a140eb3f0e
commit b001d9e08a
3 changed files with 95 additions and 143 deletions

View File

@@ -0,0 +1,91 @@
<template>
<div>
<ul>
<li
v-for="(rate, rateIndex) in rateItem"
:key="rateIndex"
class="rate_item"
:class="{ active_item: rate.active }"
@click="getItem(rate)"
>
{{ rate.label }}
</li>
</ul>
</div>
</template>
<script setup>
import { ref } from 'vue';
const rateItem = ref([
{
label: 1,
active: false
},
{
label: 2,
active: false
},
{
label: 3,
active: false
},
{
label: 4,
active: false
},
{
label: 5,
active: false
},
{
label: 6,
active: false
},
{
label: 7,
active: false
},
{
label: 8,
active: false
},
{
label: 9,
active: false
},
{
label: 10,
active: false
}
]);
const getItem = (value) => {
// chooseId.value = value.id;
rateItem.value.forEach((item, index) => {
rateItem.value[index].active = item.label <= value.label;
});
};
</script>
<style scoped lang="scss">
ul {
// border: 1px solid red;
display: flex;
margin-bottom: 10px;
}
.rate_item {
margin: 0 3px;
margin-top: 5px;
padding: 0 8px;
border: 1px solid #ddd;
border-radius: 4px;
color: #666;
// border: 1px solid red;
}
.active_item {
background-color: #70b936;
color: #fff;
}
</style>