diff --git a/src/router/index.ts b/src/router/index.ts index 59667c5..a109c7f 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -12,7 +12,7 @@ const routes: Array = [ path: '/trains', name: 'TrainsView', component: () => import('../views/TrainsView.vue'), - props: (route) => ({ train: route.query.train, driver: route.query.driver }), + props: (route) => ({ train: route.query.train, driver: route.query.driver, trainId: route.query.trainId }), }, { path: '/scenery', diff --git a/src/views/TrainsView.vue b/src/views/TrainsView.vue index 0797a4d..56cc2d9 100644 --- a/src/views/TrainsView.vue +++ b/src/views/TrainsView.vue @@ -14,6 +14,7 @@ import TrainOptions from '../components/TrainsView/TrainOptions.vue'; import TrainStats from '../components/TrainsView/TrainStats.vue'; import TrainTable from '../components/TrainsView/TrainTable.vue'; import { trainFilters } from '../constants/Trains/TrainOptionsConsts'; +import modalTrainMixin from '../mixins/modalTrainMixin'; import Train from '../scripts/interfaces/Train'; import { filteredTrainList } from '../scripts/managers/trainFilterManager'; import { useStore } from '../store/store'; @@ -26,6 +27,8 @@ export default defineComponent({ TrainOptions, }, + mixins: [modalTrainMixin], + props: { train: { type: String, @@ -36,6 +39,11 @@ export default defineComponent({ type: String, required: false, }, + + trainId: { + type: String, + required: false, + }, }, data: () => ({ @@ -71,6 +79,7 @@ export default defineComponent({ searchedTrain, searchedDriver, sorterActive, + store, }; }, @@ -80,10 +89,12 @@ export default defineComponent({ this.searchedDriver = this.driver || ''; } + this.$nextTick(() => { + if (this.trainId) { + this.selectModalTrain(this.trainId); + } + }); }, - - - });