3 changed files with 114 additions and 70 deletions
Binary file not shown.
@ -0,0 +1,46 @@ |
|||
<template> |
|||
<div > |
|||
<div class="seatWrap"> |
|||
<div class="seat" v-for="(seat, index) in seats" :key="index"> |
|||
<div v-if="chosenSeats.indexOf(seat) >= 0" v-on:click="chosenSeats.splice(chosenSeats.indexOf(seat), 1)" class="chosen"> |
|||
{{ seat }} |
|||
</div> |
|||
<div v-else-if="seat.startsWith(classType.value)" v-on:click="addSeatClick(seat)"> |
|||
{{ seat }} |
|||
</div> |
|||
<div v-else class="disabled"> |
|||
{{ seat }} |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</template> |
|||
|
|||
|
|||
|
|||
<script> |
|||
export default { |
|||
props: ["seats", "classType", "personCount", "value" ], |
|||
data: function(){ |
|||
return{ |
|||
chosenSeats: this.value |
|||
} |
|||
}, |
|||
methods:{ |
|||
addSeatClick: function(seat) { |
|||
if (this.chosenSeats.length < this.personCount) { |
|||
this.chosenSeats.push(seat); |
|||
this.$emit("input", this.chosenSeats); |
|||
} |
|||
else { |
|||
alert("Všichni cestující již sedí!"); |
|||
} |
|||
}, |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
|
|||
<style scoped> |
|||
|
|||
</style> |
Loading…
Reference in new issue