chore(sceneries): added preserving scroll state in the stations table after leaving the view

This commit is contained in:
2026-04-27 13:57:32 +02:00
parent c4decd1003
commit 08ee303886
+11 -2
View File
@@ -1,5 +1,5 @@
<template> <template>
<section class="station_table"> <section class="station_table" @scroll="onScroll" ref="tableRef">
<Loading <Loading
v-if="apiStore.dataStatuses.connection == Status.Loading && filteredStationList.length == 0" v-if="apiStore.dataStatuses.connection == Status.Loading && filteredStationList.length == 0"
/> />
@@ -363,7 +363,8 @@ export default defineComponent({
data: () => ({ data: () => ({
headIconsIds, headIconsIds,
headIds, headIds,
getChangedFilters getChangedFilters,
scrollTop: 0
}), }),
setup() { setup() {
@@ -391,6 +392,10 @@ export default defineComponent({
}; };
}, },
activated() {
(this.$refs['tableRef'] as HTMLElement).scrollTop = this.scrollTop;
},
methods: { methods: {
getSceneryRoute(station: Station) { getSceneryRoute(station: Station) {
this.$router.push({ this.$router.push({
@@ -431,6 +436,10 @@ export default defineComponent({
})); }));
return JSON.stringify(usersTrains); return JSON.stringify(usersTrains);
},
onScroll(e: Event) {
this.scrollTop = (e.target as HTMLElement).scrollTop;
} }
} }
}); });