summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsyuilo <Syuilotan@yahoo.co.jp>2022-07-02 12:12:10 +0900
committersyuilo <Syuilotan@yahoo.co.jp>2022-07-02 12:12:10 +0900
commit6bcd5cb310b92394de81cc8a02a2d3005fbd88a5 (patch)
tree242416a22dace52a7c58a94c1aaea494d3755469
parentfeat(client): poll highlights in explore page (diff)
downloadsharkey-6bcd5cb310b92394de81cc8a02a2d3005fbd88a5.tar.gz
sharkey-6bcd5cb310b92394de81cc8a02a2d3005fbd88a5.tar.bz2
sharkey-6bcd5cb310b92394de81cc8a02a2d3005fbd88a5.zip
enhance(client): cache pages in page-window
-rw-r--r--packages/client/src/components/page-window.vue9
1 files changed, 6 insertions, 3 deletions
diff --git a/packages/client/src/components/page-window.vue b/packages/client/src/components/page-window.vue
index 7de09d3be4..886f480bfb 100644
--- a/packages/client/src/components/page-window.vue
+++ b/packages/client/src/components/page-window.vue
@@ -48,7 +48,10 @@ const router = new Router(routes, props.initialPath);
let pageMetadata = $ref<null | ComputedRef<PageMetadata>>();
let windowEl = $ref<InstanceType<typeof XWindow>>();
-const history = $ref<string[]>([props.initialPath]);
+const history = $ref<{ path: string; key: any; }[]>([{
+ path: router.getCurrentPath(),
+ key: router.getCurrentKey(),
+}]);
const buttonsLeft = $computed(() => {
const buttons = [];
@@ -72,7 +75,7 @@ const buttonsRight = $computed(() => {
});
router.addListener('push', ctx => {
- history.push(router.getCurrentPath());
+ history.push({ path: ctx.path, key: ctx.key });
});
provide('router', router);
@@ -111,7 +114,7 @@ function menu(ev) {
function back() {
history.pop();
- router.change(history[history.length - 1]);
+ router.change(history[history.length - 1].path, history[history.length - 1].key);
}
function close() {