feat(projects): new layout,tab and add update theme settings

This commit is contained in:
Soybean
2023-03-13 20:49:33 +08:00
parent 488e6e3204
commit 912c3531c5
30 changed files with 386 additions and 93 deletions

View File

@ -1,8 +1,9 @@
import type { RouterScrollBehavior } from 'vue-router';
import { useTabStore } from '@/store';
import { useAppStore, useTabStore } from '@/store';
export const scrollBehavior: RouterScrollBehavior = (to, from) => {
return new Promise(resolve => {
const app = useAppStore();
const tab = useTabStore();
if (to.hash) {
@ -20,17 +21,18 @@ export const scrollBehavior: RouterScrollBehavior = (to, from) => {
left,
top
};
const { scrollLeft, scrollTop } = document.documentElement;
const { scrollEl, scrollLeft, scrollTop } = app.getScrollConfig();
const isFromCached = Boolean(from.meta.keepAlive);
if (isFromCached) {
tab.recordTabScrollPosition(from.path, { left: scrollLeft, top: scrollTop });
}
const duration = !scrollPosition.left && !scrollPosition.top ? 0 : 350;
setTimeout(() => {
resolve(scrollPosition);
}, duration);
if (scrollEl) {
scrollEl.scrollLeft = scrollPosition.left;
scrollEl.scrollTop = scrollPosition.top;
}
}, 400);
});
};

View File

@ -5,6 +5,7 @@ const about1: AuthRoute.Route = {
meta: {
title: '关于',
requiresAuth: true,
keepAlive: true,
singleLayout: 'basic',
permissions: ['super', 'admin', 'user'],
icon: 'fluent:book-information-24-regular',