mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-12-23 18:53:08 +02:00
enhance(client): cache pages in page-window
This commit is contained in:
parent
01d5a97a4f
commit
6bcd5cb310
1 changed files with 6 additions and 3 deletions
|
@ -48,7 +48,10 @@ const router = new Router(routes, props.initialPath);
|
||||||
|
|
||||||
let pageMetadata = $ref<null | ComputedRef<PageMetadata>>();
|
let pageMetadata = $ref<null | ComputedRef<PageMetadata>>();
|
||||||
let windowEl = $ref<InstanceType<typeof XWindow>>();
|
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 buttonsLeft = $computed(() => {
|
||||||
const buttons = [];
|
const buttons = [];
|
||||||
|
|
||||||
|
@ -72,7 +75,7 @@ const buttonsRight = $computed(() => {
|
||||||
});
|
});
|
||||||
|
|
||||||
router.addListener('push', ctx => {
|
router.addListener('push', ctx => {
|
||||||
history.push(router.getCurrentPath());
|
history.push({ path: ctx.path, key: ctx.key });
|
||||||
});
|
});
|
||||||
|
|
||||||
provide('router', router);
|
provide('router', router);
|
||||||
|
@ -111,7 +114,7 @@ function menu(ev) {
|
||||||
|
|
||||||
function back() {
|
function back() {
|
||||||
history.pop();
|
history.pop();
|
||||||
router.change(history[history.length - 1]);
|
router.change(history[history.length - 1].path, history[history.length - 1].key);
|
||||||
}
|
}
|
||||||
|
|
||||||
function close() {
|
function close() {
|
||||||
|
|
Loading…
Reference in a new issue