Skip to content

Commit 75cc4b1

Browse files
committed
Fix rating input
1 parent a7a3213 commit 75cc4b1

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

client/components/forms/RatingInput.vue

+10-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
</template>
88

99
<div class="stars-outer">
10-
<div v-for="i in numberOfStars" :key="i"
10+
<div v-for="i in starsCount" :key="i"
1111
class="cursor-pointer inline-block text-gray-200 dark:text-gray-800"
1212
:class="{'!text-yellow-400 active-star':i<=compVal, '!text-yellow-200 !dark:text-yellow-800 hover-star':i>compVal && i<=hoverRating, '!cursor-not-allowed':disabled}"
1313
role="button" @click="setRating(i)"
@@ -66,6 +66,15 @@ export default {
6666
}
6767
},
6868
69+
computed: {
70+
starsCount() {
71+
if (!this.numberOfStars || this.numberOfStars < 1) {
72+
return 5
73+
}
74+
return this.numberOfStars
75+
}
76+
},
77+
6978
methods: {
7079
onMouseHover (i) {
7180
this.hoverRating = (this.disabled) ? -1 : i

0 commit comments

Comments
 (0)