refactor: refacotr preference
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
import type { ExRouteRecordRaw, MenuRecordRaw } from '@vben/types';
|
||||
|
||||
import { useAccessStore } from '@vben-core/stores';
|
||||
import type { RouteRecordRaw, Router } from 'vue-router';
|
||||
|
||||
import { LOGIN_PATH } from '@vben/constants';
|
||||
import { useAccessStore } from '@vben/stores';
|
||||
import { filterTree, mapTree, traverseTreeValues } from '@vben/utils';
|
||||
|
||||
import { dynamicRoutes } from '@/router/routes';
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { preferences } from '@vben-core/preferences';
|
||||
import type { Router } from 'vue-router';
|
||||
|
||||
import { $t } from '@vben/locales';
|
||||
import { preference } from '@vben/preference';
|
||||
import { startProgress, stopProgress } from '@vben/utils';
|
||||
import { useTitle } from '@vueuse/core';
|
||||
|
||||
@@ -17,7 +17,7 @@ function configCommonGuard(router: Router) {
|
||||
|
||||
router.beforeEach(async (to) => {
|
||||
// 页面加载进度条
|
||||
if (preference.pageProgress) {
|
||||
if (preferences.transition.progress) {
|
||||
startProgress();
|
||||
}
|
||||
to.meta.loaded = loadedPaths.has(to.path);
|
||||
@@ -29,14 +29,14 @@ function configCommonGuard(router: Router) {
|
||||
loadedPaths.add(to.path);
|
||||
|
||||
// 关闭页面加载进度条
|
||||
if (preference.pageProgress) {
|
||||
if (preferences.transition.progress) {
|
||||
stopProgress();
|
||||
}
|
||||
|
||||
// 动态修改标题
|
||||
if (preference.dynamicTitle) {
|
||||
if (preferences.app.dynamicTitle) {
|
||||
const { title } = to.meta;
|
||||
useTitle(`${$t(title)} - ${preference.appName}`);
|
||||
useTitle(`${$t(title)} - ${preferences.app.name}`);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { RouteRecordRaw } from 'vue-router';
|
||||
|
||||
import { AuthPageLayout } from '@/layouts';
|
||||
import { AuthPageLayoutType } from '@/layouts';
|
||||
import { Fallback } from '@vben/common-ui';
|
||||
import { $t } from '@vben/locales';
|
||||
|
||||
@@ -9,7 +9,7 @@ import Login from '@/views/_essential/authentication/login.vue';
|
||||
/** 基本路由,这些路由是必须存在的 */
|
||||
const essentialRoutes: RouteRecordRaw[] = [
|
||||
{
|
||||
component: AuthPageLayout,
|
||||
component: AuthPageLayoutType,
|
||||
meta: {
|
||||
title: 'Authentication',
|
||||
},
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
import { preferences } from '@vben-core/preferences';
|
||||
import type { RouteRecordRaw } from 'vue-router';
|
||||
|
||||
import { BasicLayout, IFrameView } from '@/layouts';
|
||||
import { VBEN_GITHUB_URL } from '@vben/constants';
|
||||
import { $t } from '@vben/locales/helper';
|
||||
import { preference } from '@vben/preference';
|
||||
|
||||
export const vbenRoutes: RouteRecordRaw[] = [
|
||||
{
|
||||
component: BasicLayout,
|
||||
meta: {
|
||||
icon: preference.logo,
|
||||
icon: preferences.logo.source,
|
||||
title: 'Vben',
|
||||
},
|
||||
name: 'AboutLayout',
|
||||
|
||||
Reference in New Issue
Block a user