Naprawiono odnośnik do pociągu na liście rozkładów scenerii

This commit is contained in:
2022-01-16 18:05:05 +01:00
parent c086c4fd09
commit 562b9a64ca
4 changed files with 65 additions and 84 deletions
+15 -5
View File
@@ -13,7 +13,7 @@
</template>
<script lang="ts">
import { computed, ComputedRef, defineComponent, provide, reactive, Ref, ref } from 'vue';
import { computed, ComputedRef, defineComponent, provide, reactive, Ref, ref, watch } from 'vue';
import { DataStatus } from '@/scripts/enums/DataStatus';
import Train from '@/scripts/interfaces/Train';
@@ -80,7 +80,6 @@ export default defineComponent({
data: () => ({
statsIcon: require('@/assets/icon-stats.svg'),
trainStatsOpen: false,
queryTrain: '',
}),
setup(props) {
@@ -94,12 +93,9 @@ export default defineComponent({
const searchedDriver = ref('');
const searchedTrain = ref('');
const queryTrain = ref(props.train) as Ref<string>;
provide('searchedTrain', searchedTrain);
provide('searchedDriver', searchedDriver);
provide('sorterActive', sorterActive);
provide('queryTrain', queryTrain);
const computedTrains: ComputedRef<Train[]> = computed(() => {
if (timetableDataStatus.value != DataStatus.Loaded) return [];
@@ -120,6 +116,20 @@ export default defineComponent({
chosenTrainCategories,
};
},
mounted() {
if (this.train) {
this.searchedTrain = this.train;
this.searchedDriver = '';
}
},
activated() {
if (this.train) {
this.searchedTrain = this.train;
this.searchedDriver = '';
}
},
});
</script>