Fix błędu z wyborem ładunków

This commit is contained in:
2022-08-22 14:15:23 +02:00
parent 1cd1d47b3f
commit 355df789aa
2 changed files with 8 additions and 4 deletions
+7 -3
View File
@@ -70,8 +70,8 @@
data-select="cargo" data-select="cargo"
data-ignore-outside="1" data-ignore-outside="1"
v-model="store.chosenCargo" v-model="store.chosenCargo"
@focus="onVehicleSelect('car')" @focus="onVehicleSelect('cargo')"
@change="onVehicleSelect('car')" @change="onVehicleSelect('cargo')"
@keydown.enter.prevent="addOrSwitchVehicle" @keydown.enter.prevent="addOrSwitchVehicle"
@keydown.backspace="removeVehicle" @keydown.backspace="removeVehicle"
> >
@@ -199,11 +199,14 @@ export default defineComponent({
this.store.swapVehicles = true; this.store.swapVehicles = true;
}, },
onVehicleSelect(type: 'loco' | 'car') { onVehicleSelect(type: 'loco' | 'car' | 'cargo') {
this.$nextTick(() => { this.$nextTick(() => {
if (!this.store.chosenLoco && !this.store.chosenCar) return; if (!this.store.chosenLoco && !this.store.chosenCar) return;
this.store.chosenVehicle = type == 'loco' ? this.store.chosenLoco : this.store.chosenCar; this.store.chosenVehicle = type == 'loco' ? this.store.chosenLoco : this.store.chosenCar;
this.store.chosenCargo =
this.store.chosenCar?.cargoList.find((cargo) => cargo.id == this.store.chosenCargo?.id) || null;
}); });
}, },
@@ -362,3 +365,4 @@ export default defineComponent({
} }
} }
</style> </style>
+1 -1
View File
@@ -116,7 +116,7 @@ export default defineComponent({
grid-column: 1; grid-column: 1;
margin-top: 2em; margin-top: 2em;
height: 290px; height: 20em;
} }
.train-image { .train-image {