Skip to content

Beautiful Open-Source Form Builder

Fix rating input

Julien Nahum75cc4b19e102
diff --git a/client/components/forms/RatingInput.vue b/client/components/forms/RatingInput.vue
index d0b091e09..564da2d38 100644
--- a/client/components/forms/RatingInput.vue
+++ b/client/components/forms/RatingInput.vue
@@ -7,7 +7,7 @@
</template>
<div class="stars-outer">
- <div v-for="i in numberOfStars" :key="i"
+ <div v-for="i in starsCount" :key="i"
class="cursor-pointer inline-block text-gray-200 dark:text-gray-800"
: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}"
role="button" @click="setRating(i)"
@@ -66,6 +66,15 @@ export default {
}
},
+ computed: {
+ starsCount() {
+ if (!this.numberOfStars || this.numberOfStars < 1) {
+ return 5
+ }
+ return this.numberOfStars
+ }
+ },
+
methods: {
onMouseHover (i) {
this.hoverRating = (this.disabled) ? -1 : i