diff options
Diffstat (limited to 'viewer/src/views/MainLayout.vue')
-rw-r--r-- | viewer/src/views/MainLayout.vue | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/viewer/src/views/MainLayout.vue b/viewer/src/views/MainLayout.vue index 31b0440..12388a9 100644 --- a/viewer/src/views/MainLayout.vue +++ b/viewer/src/views/MainLayout.vue | |||
@@ -21,7 +21,7 @@ | |||
21 | <div :class="{'fullscreen': $uiStore.fullscreen, 'fullwidth': $uiStore.fullWidth}"> | 21 | <div :class="{'fullscreen': $uiStore.fullscreen, 'fullwidth': $uiStore.fullWidth}"> |
22 | <panel-top v-if="!isLoading" class="layout layout-top" /> | 22 | <panel-top v-if="!isLoading" class="layout layout-top" /> |
23 | <panel-left v-if="!isLoading" class="layout layout-left" /> | 23 | <panel-left v-if="!isLoading" class="layout layout-left" /> |
24 | <router-view v-if="!isLoading" class="layout layout-content scrollbar" /> | 24 | <router-view v-if="!isLoading" ref="content" class="layout layout-content scrollbar" /> |
25 | <b-loading :active="isLoading" is-full-page /> | 25 | <b-loading :active="isLoading" is-full-page /> |
26 | <ld-key-press :keycode="27" @action="$uiStore.fullscreen=false" /> | 26 | <ld-key-press :keycode="27" @action="$uiStore.fullscreen=false" /> |
27 | 27 | ||
@@ -32,20 +32,31 @@ | |||
32 | </template> | 32 | </template> |
33 | 33 | ||
34 | <script lang="ts"> | 34 | <script lang="ts"> |
35 | import { Component, Vue } from "vue-property-decorator"; | 35 | import { Component, Vue, Ref, Watch } from "vue-property-decorator"; |
36 | import PanelLeft from "./PanelLeft.vue"; | 36 | import PanelLeft from "./PanelLeft.vue"; |
37 | import PanelTop from "./PanelTop.vue"; | 37 | import PanelTop from "./PanelTop.vue"; |
38 | import { Route } from "vue-router"; | ||
38 | 39 | ||
39 | @Component({ | 40 | @Component({ |
40 | components: { PanelLeft, PanelTop }, | 41 | components: { PanelLeft, PanelTop }, |
41 | }) | 42 | }) |
42 | export default class MainLayout extends Vue { | 43 | export default class MainLayout extends Vue { |
44 | @Ref() readonly content!: Vue; | ||
45 | |||
43 | isLoading: boolean = true; | 46 | isLoading: boolean = true; |
47 | scrollPositions: ScrollPosition = {}; | ||
44 | 48 | ||
45 | mounted() { | 49 | mounted() { |
46 | this.fetchGalleryItems(); | 50 | this.fetchGalleryItems(); |
47 | } | 51 | } |
48 | 52 | ||
53 | @Watch("$route") | ||
54 | routeChanged(newRoute: Route, oldRoute: Route) { | ||
55 | const el = this.content.$el; | ||
56 | this.scrollPositions[oldRoute.path] = el.scrollTop; | ||
57 | this.$nextTick(() => (el.scrollTop = this.scrollPositions[newRoute.path])); | ||
58 | } | ||
59 | |||
49 | fetchGalleryItems() { | 60 | fetchGalleryItems() { |
50 | this.isLoading = true; | 61 | this.isLoading = true; |
51 | this.$galleryStore | 62 | this.$galleryStore |