rework reaktywności danych z API i WS

This commit is contained in:
2023-10-30 23:19:17 +01:00
parent 12ece46089
commit 8de03b9210
24 changed files with 501 additions and 446 deletions
+12 -3
View File
@@ -6,7 +6,10 @@ const routes: Array<RouteRecordRaw> = [
{
path: '/',
name: 'StationsView',
component: () => import('../views/StationsView.vue')
component: () => import('../views/StationsView.vue'),
props: (route) => ({
region: route.query.region
})
},
{
path: '/trains',
@@ -21,7 +24,11 @@ const routes: Array<RouteRecordRaw> = [
{
path: '/scenery',
name: 'SceneryView',
component: () => import('../views/SceneryView.vue')
component: () => import('../views/SceneryView.vue'),
props: (route) => ({
region: route.query.region,
station: route.query.station
})
},
{
path: '/journal',
@@ -53,9 +60,11 @@ const routes: Array<RouteRecordRaw> = [
];
const router = createRouter({
scrollBehavior(to, from) {
scrollBehavior(to, from, savedPosition) {
if (to.name == 'SceneryView' && from.name) return { el: `.app_main` };
if (savedPosition) return savedPosition;
// if (from.name == 'SceneryView' && to.name == 'StationsView') return { el: `.last-selected`, top: 20 };
},
history: createWebHistory(),