Fix rating input
This commit is contained in:
parent
a7a32134a6
commit
75cc4b19e1
|
|
@ -7,7 +7,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<div class="stars-outer">
|
<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="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}"
|
: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)"
|
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: {
|
methods: {
|
||||||
onMouseHover (i) {
|
onMouseHover (i) {
|
||||||
this.hoverRating = (this.disabled) ? -1 : i
|
this.hoverRating = (this.disabled) ? -1 : i
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue