Browse Source

dokonceno

master
Harazim 4 years ago
parent
commit
048d063597
  1. 6
      src/App.vue
  2. 9
      src/components/SeatPicker.vue

6
src/App.vue

@ -53,7 +53,7 @@
</select> </select>
</p> </p>
<Seat-picker :seats="seats" :classType="classType" :personCount= "personCount" />
<Seat-picker v-model= "chosenSeats" :seats= "seats" :classType= "classType" :personCount= "personCount" />
</form> </form>
</div> </div>
@ -119,8 +119,8 @@ export default {
return { return {
travelType: "", travelType: "",
travelTypes: [ travelTypes: [
{ value: "R", text: "TwoWay" },
{ value: "O", text: "OneWay" },
{ value: "R", text: "Obousměrná" },
{ value: "O", text: "Jednosměrná" },
], ],
personCount: 1, personCount: 1,
classType: "", classType: "",

9
src/components/SeatPicker.vue

@ -18,23 +18,26 @@
<script> <script>
export default { export default {
propS: ["seats", "classType", "personCount", ],
propS: ["seats", "classType", "personCount", "Value" ],
data: function() { data: function() {
return { return {
chosenSeats: [],
chosenSeats: this.Value,
} }
}, },
methods: { methods: {
addSeatClick: function(seat) { addSeatClick: function(seat) {
if (this.chosenSeats.length < this.personCount) { if (this.chosenSeats.length < this.personCount) {
this.chosenSeats.push(seat); this.chosenSeats.push(seat);
this.$emit("input", this.chosenSeats);
} }
else { else {
alert("Všichni cestující již sedí!"); alert("Všichni cestující již sedí!");
} }
}, },
},
watch: function(Value){
this.chosenSeats = Value;
} }
} }
</script> </script>

Loading…
Cancel
Save