mirror of
https://github.com/vbenjs/vue-vben-admin.git
synced 2025-08-23 14:46:18 +08:00
feat(other): The menu supports jumping to external links and fixing some known problems
This commit is contained in:
@@ -26,17 +26,18 @@
|
||||
"dependencies": {
|
||||
"@vben-core/design": "workspace:*",
|
||||
"@vben-core/design-tokens": "workspace:*",
|
||||
"@vben-core/toolkit": "workspace:*",
|
||||
"@vben-core/typings": "workspace:*",
|
||||
"@vben/common-ui": "workspace:*",
|
||||
"@vben/constants": "workspace:*",
|
||||
"@vben/hooks": "workspace:*",
|
||||
"@vben/icons": "workspace:*",
|
||||
"@vben/layouts": "workspace:*",
|
||||
"@vben/locales": "workspace:*",
|
||||
"@vben/preference": "workspace:*",
|
||||
"@vben/stores": "workspace:*",
|
||||
"@vben/utils": "workspace:*",
|
||||
"ant-design-vue": "^4.2.1",
|
||||
"axios": "^1.6.8",
|
||||
"axios": "^1.7.1",
|
||||
"dayjs": "^1.11.11",
|
||||
"vue": "^3.4.27",
|
||||
"vue-router": "^4.3.2"
|
||||
|
@@ -1,8 +1,6 @@
|
||||
<script lang="ts" setup>
|
||||
import type { NotificationItem } from '@vben/common-ui';
|
||||
|
||||
import { openWindow } from '@vben-core/toolkit';
|
||||
|
||||
import { Notification, UserDropdown } from '@vben/common-ui';
|
||||
import {
|
||||
IcRoundCreditScore,
|
||||
@@ -14,6 +12,7 @@ import { BasicLayout } from '@vben/layouts';
|
||||
import { $t } from '@vben/locales';
|
||||
import { preference } from '@vben/preference';
|
||||
import { useAccessStore } from '@vben/stores';
|
||||
import { openWindow } from '@vben/utils';
|
||||
import { computed, ref } from 'vue';
|
||||
import { useRouter } from 'vue-router';
|
||||
|
||||
|
@@ -1,9 +1,9 @@
|
||||
import type { ExRouteRecordRaw, MenuRecordRaw } from '@vben-core/typings';
|
||||
|
||||
import { filterTree, mapTree, traverseTreeValues } from '@vben-core/toolkit';
|
||||
import type { RouteRecordRaw, Router } from 'vue-router';
|
||||
|
||||
import { useAccessStore } from '@vben/stores';
|
||||
import { filterTree, mapTree, traverseTreeValues } from '@vben/utils';
|
||||
|
||||
import { dynamicRoutes } from '../routes';
|
||||
|
||||
@@ -120,6 +120,7 @@ async function generatorMenus(
|
||||
hideChildrenInMenu = false,
|
||||
icon,
|
||||
orderNo,
|
||||
target,
|
||||
title = '',
|
||||
} = meta || {};
|
||||
|
||||
@@ -138,7 +139,7 @@ async function generatorMenus(
|
||||
});
|
||||
}
|
||||
// 隐藏子菜单
|
||||
const resultPath = hideChildrenInMenu ? redirect : path;
|
||||
const resultPath = hideChildrenInMenu ? redirect : target || path;
|
||||
return {
|
||||
badge,
|
||||
badgeType,
|
||||
|
@@ -1,7 +1,7 @@
|
||||
import { startProgress, stopProgress } from '@vben-core/toolkit';
|
||||
import type { Router } from 'vue-router';
|
||||
|
||||
import { preference } from '@vben/preference';
|
||||
import { startProgress, stopProgress } from '@vben/utils';
|
||||
|
||||
import { configAccessGuard } from './access';
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
import { traverseTreeValues } from '@vben-core/toolkit';
|
||||
import type { RouteRecordName, RouteRecordRaw } from 'vue-router';
|
||||
|
||||
import { traverseTreeValues } from '@vben/utils';
|
||||
import { createRouter, createWebHashHistory } from 'vue-router';
|
||||
|
||||
import { createRouteGuard } from './guard';
|
||||
|
@@ -4,6 +4,7 @@ import { builtinRoutes } from './builtin';
|
||||
import { Layout } from './layout';
|
||||
import { nestedRoutes } from './modules/nested';
|
||||
import { outsideRoutes } from './modules/outside';
|
||||
import { vbenRoutes } from './modules/vben';
|
||||
|
||||
/** 动态路由 */
|
||||
const dynamicRoutes: RouteRecordRaw[] = [
|
||||
@@ -31,30 +32,7 @@ const dynamicRoutes: RouteRecordRaw[] = [
|
||||
},
|
||||
...nestedRoutes,
|
||||
...outsideRoutes,
|
||||
// 关于
|
||||
{
|
||||
component: Layout,
|
||||
meta: {
|
||||
hideChildrenInMenu: true,
|
||||
icon: 'https://cdn.jsdelivr.net/gh/vbenjs/vben-cdn-static@0.1.2/vben-admin/admin-logo.png',
|
||||
keepAlive: false,
|
||||
title: '关于',
|
||||
},
|
||||
name: 'AboutLayout',
|
||||
path: '/about',
|
||||
redirect: '/about/index',
|
||||
children: [
|
||||
{
|
||||
name: 'About',
|
||||
path: 'index',
|
||||
component: () => import('@/views/about/index.vue'),
|
||||
meta: {
|
||||
keepAlive: false,
|
||||
title: '关于',
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
...vbenRoutes,
|
||||
];
|
||||
|
||||
/** 排除在主框架外的路由,这些路由没有菜单和顶部及其他框架内容 */
|
||||
|
50
apps/antd-view/src/router/routes/modules/vben.ts
Normal file
50
apps/antd-view/src/router/routes/modules/vben.ts
Normal file
@@ -0,0 +1,50 @@
|
||||
import type { RouteRecordRaw } from 'vue-router';
|
||||
|
||||
import { VBEN_GITHUB_URL } from '@vben/constants';
|
||||
import { $t } from '@vben/locales/helper';
|
||||
import { preference } from '@vben/preference';
|
||||
|
||||
import { IFrameView, Layout } from '@/router/routes/layout';
|
||||
|
||||
export const vbenRoutes: RouteRecordRaw[] = [
|
||||
{
|
||||
component: Layout,
|
||||
meta: {
|
||||
icon: preference.logo,
|
||||
title: 'Vben Admin',
|
||||
},
|
||||
name: 'AboutLayout',
|
||||
path: '/vben-admin',
|
||||
redirect: '/vben-admin/about',
|
||||
children: [
|
||||
{
|
||||
name: 'About',
|
||||
path: 'about',
|
||||
component: () => import('@/views/about/index.vue'),
|
||||
meta: {
|
||||
icon: 'mdi:creative-commons',
|
||||
title: $t('page.about'),
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'AboutDocument',
|
||||
path: 'document',
|
||||
component: () => import('@/views/about/index.vue'),
|
||||
meta: {
|
||||
icon: 'mdi:flame-circle',
|
||||
title: $t('page.document'),
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'Github',
|
||||
path: 'github',
|
||||
component: IFrameView,
|
||||
meta: {
|
||||
icon: 'mdi:github',
|
||||
target: VBEN_GITHUB_URL,
|
||||
title: 'Github',
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
Reference in New Issue
Block a user