mirror of
https://github.com/Spythere/stacjownik.git
synced 2026-05-04 13:58:12 +00:00
Możliwość dodawania numeru pociągu w linku
This commit is contained in:
@@ -242,7 +242,7 @@ export default defineComponent({
|
|||||||
navigateToTrain(trainNo: number) {
|
navigateToTrain(trainNo: number) {
|
||||||
this.$router.push({
|
this.$router.push({
|
||||||
name: "TrainsView",
|
name: "TrainsView",
|
||||||
params: { train: trainNo.toString() },
|
query: { train: trainNo.toString() },
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -51,7 +51,7 @@
|
|||||||
<router-link
|
<router-link
|
||||||
:to="{
|
:to="{
|
||||||
name: 'TrainsView',
|
name: 'TrainsView',
|
||||||
params: {
|
query: {
|
||||||
train: scheduledTrain.trainNo.toString(),
|
train: scheduledTrain.trainNo.toString(),
|
||||||
},
|
},
|
||||||
}"
|
}"
|
||||||
|
|||||||
@@ -169,7 +169,7 @@
|
|||||||
>
|
>
|
||||||
<TrainSchedule
|
<TrainSchedule
|
||||||
v-if="showedSchedule === train.timetableData?.timetableId"
|
v-if="showedSchedule === train.timetableData?.timetableId"
|
||||||
:followingStops="train.timetableData.followingStops"
|
:followingStops="train.timetableData?.followingStops"
|
||||||
@click="changeScheduleShowState(train.timetableData?.timetableId)"
|
@click="changeScheduleShowState(train.timetableData?.timetableId)"
|
||||||
/>
|
/>
|
||||||
</transition>
|
</transition>
|
||||||
@@ -188,8 +188,10 @@ import {
|
|||||||
computed,
|
computed,
|
||||||
ComputedRef,
|
ComputedRef,
|
||||||
defineComponent,
|
defineComponent,
|
||||||
|
reactive,
|
||||||
Ref,
|
Ref,
|
||||||
ref,
|
ref,
|
||||||
|
watch,
|
||||||
} from "@vue/runtime-core";
|
} from "@vue/runtime-core";
|
||||||
import { useStore } from "@/store";
|
import { useStore } from "@/store";
|
||||||
import { GETTERS } from "@/constants/storeConstants";
|
import { GETTERS } from "@/constants/storeConstants";
|
||||||
@@ -270,6 +272,20 @@ export default defineComponent({
|
|||||||
() => store.getters[GETTERS.timetableDataStatus]
|
() => store.getters[GETTERS.timetableDataStatus]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const queryTimetable = computed(
|
||||||
|
() =>
|
||||||
|
props.computedTrains.find(
|
||||||
|
(train) => train.trainNo === Number(props.queryTrain)
|
||||||
|
)?.timetableData
|
||||||
|
);
|
||||||
|
|
||||||
|
// watch(
|
||||||
|
// () => queryTimetable.value,
|
||||||
|
// (val, prevVal) => {
|
||||||
|
|
||||||
|
// }
|
||||||
|
// );
|
||||||
|
|
||||||
// const observer = new IntersectionObserver((entries) => {
|
// const observer = new IntersectionObserver((entries) => {
|
||||||
// entries.forEach((entry) => {
|
// entries.forEach((entry) => {
|
||||||
// if (entry.isIntersecting) {
|
// if (entry.isIntersecting) {
|
||||||
@@ -283,6 +299,7 @@ export default defineComponent({
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
elList,
|
elList,
|
||||||
|
queryTimetable,
|
||||||
timetableLoaded: computed(
|
timetableLoaded: computed(
|
||||||
() => timetableDataStatus.value === DataStatus.Loaded
|
() => timetableDataStatus.value === DataStatus.Loaded
|
||||||
),
|
),
|
||||||
@@ -299,6 +316,14 @@ export default defineComponent({
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// watch: {
|
||||||
|
// queryTimetable(timetable: Train["timetableData"]) {
|
||||||
|
// if (!timetable || !this.queryTrain) return;
|
||||||
|
|
||||||
|
// this.focusOnTrain(this.queryTrain);
|
||||||
|
// },
|
||||||
|
// },
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
enter(el: HTMLElement) {
|
enter(el: HTMLElement) {
|
||||||
const maxHeight = getComputedStyle(el).height;
|
const maxHeight = getComputedStyle(el).height;
|
||||||
@@ -323,6 +348,7 @@ export default defineComponent({
|
|||||||
el.style.height = "0px";
|
el.style.height = "0px";
|
||||||
}, 10);
|
}, 10);
|
||||||
},
|
},
|
||||||
|
|
||||||
focusOnTrain(trainNoStr: string) {
|
focusOnTrain(trainNoStr: string) {
|
||||||
const timetableId = this.computedTrains.find(
|
const timetableId = this.computedTrains.find(
|
||||||
(train) => train.trainNo == Number(trainNoStr)
|
(train) => train.trainNo == Number(trainNoStr)
|
||||||
@@ -346,7 +372,7 @@ export default defineComponent({
|
|||||||
behavior: "smooth",
|
behavior: "smooth",
|
||||||
block: this.showedSchedule == 0 ? "nearest" : "center",
|
block: this.showedSchedule == 0 ? "nearest" : "center",
|
||||||
});
|
});
|
||||||
}, 175);
|
}, 200);
|
||||||
},
|
},
|
||||||
|
|
||||||
onImageError(e: Event) {
|
onImageError(e: Event) {
|
||||||
|
|||||||
+1
-2
@@ -12,8 +12,7 @@ const routes: Array<RouteRecordRaw> = [
|
|||||||
path: "/trains",
|
path: "/trains",
|
||||||
name: "TrainsView",
|
name: "TrainsView",
|
||||||
component: () => import("@/views/TrainsView.vue"),
|
component: () => import("@/views/TrainsView.vue"),
|
||||||
props: true,
|
props: route => ({ train: route.query.train })
|
||||||
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "/scenery",
|
path: "/scenery",
|
||||||
|
|||||||
@@ -257,7 +257,7 @@ export default defineComponent({
|
|||||||
|
|
||||||
this.$router.push({
|
this.$router.push({
|
||||||
name: "TrainsView",
|
name: "TrainsView",
|
||||||
params: { train: trainNo.toString() },
|
query: { train: trainNo.toString() },
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user