mirror of
https://github.com/Spythere/stacjownik.git
synced 2026-05-03 13:28:11 +00:00
35 lines
857 B
TypeScript
35 lines
857 B
TypeScript
import { defineComponent } from 'vue';
|
|
import { useMainStore } from '../store/mainStore';
|
|
|
|
export default defineComponent({
|
|
data() {
|
|
return {
|
|
store: useMainStore()
|
|
};
|
|
},
|
|
|
|
computed: {
|
|
chosenTrain() {
|
|
return this.store.trainList.find((train) => train.trainId == this.store.chosenModalTrainId);
|
|
}
|
|
},
|
|
|
|
methods: {
|
|
selectModalTrain(trainId: string, target?: EventTarget | null) {
|
|
this.store.chosenModalTrainId = trainId;
|
|
document.body.classList.add('no-scroll');
|
|
if (target) this.store.modalLastClickedTarget = target;
|
|
},
|
|
|
|
closeModal() {
|
|
this.store.chosenModalTrainId = undefined;
|
|
this.store.popUpData.key = null;
|
|
|
|
setTimeout(() => {
|
|
(this.store.modalLastClickedTarget as any)?.focus();
|
|
document.body.classList.remove('no-scroll');
|
|
}, 150);
|
|
}
|
|
}
|
|
});
|