mirror of
https://github.com/m-xlsea/ruoyi-plus-soybean.git
synced 2025-09-24 07:49:47 +08:00
feat(projects): new layout,tab and add update theme settings
This commit is contained in:
@ -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);
|
||||
});
|
||||
};
|
||||
|
@ -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',
|
||||
|
Reference in New Issue
Block a user