diff --git a/src/global.d.ts b/src/global.d.ts index 4a0193a9..5416348a 100644 --- a/src/global.d.ts +++ b/src/global.d.ts @@ -220,6 +220,7 @@ declare module 'vue-router' { breadcrumb?: boolean activeMenu?: string cache?: boolean | string | string[] + link?: string breadcrumbNeste?: Route.breadcrumb[] } } @@ -250,6 +251,7 @@ declare namespace Menu { defaultOpened?: boolean auth?: string | string[] sidebar?: boolean + link?: string } children?: recordRaw[] } diff --git a/src/layouts/components/Search/index.vue b/src/layouts/components/Search/index.vue index 1077250c..18acdad5 100644 --- a/src/layouts/components/Search/index.vue +++ b/src/layouts/components/Search/index.vue @@ -2,7 +2,6 @@ import { cloneDeep } from 'lodash-es' import hotkeys from 'hotkeys-js' import type { RouteRecordRaw } from 'vue-router' -import { isExternalLink } from '@/utils' import eventBus from '@/utils/eventBus' import useSettingsStore from '@/store/modules/settings' import useRouteStore from '@/store/modules/route' @@ -16,10 +15,11 @@ const routeStore = useRouteStore() const menuStore = useMenuStore() interface listTypes { + path: string icon?: string title?: string | Function + link?: string breadcrumb: (string | Function | undefined)[] - path: string } const isShow = ref(false) @@ -151,18 +151,12 @@ function getSourceList(arr: RouteRecordRaw[], basePath?: string, icon?: string, } else { breadcrumbTemp.push(item.meta?.title) - let path = '' - if (isExternalLink(item.path)) { - path = item.path - } - else { - path = basePath ? [basePath, item.path].join('/') : item.path - } sourceList.value.push({ + path: basePath ? [basePath, item.path].join('/') : item.path, icon: item.meta?.icon ?? icon, title: item.meta?.title, + link: item.meta?.link, breadcrumb: breadcrumbTemp, - path, }) } } @@ -230,12 +224,12 @@ function handleScroll() { }) } -function pageJump(url: string) { - if (isExternalLink(url)) { - window.open(url, 'top') +function pageJump(path: listTypes['path'], link: listTypes['link']) { + if (link) { + window.open(link, '_blank') } else { - router.push(url) + router.push(path) } } @@ -284,7 +278,7 @@ function pageJump(url: string) {
- + diff --git a/src/layouts/components/SidebarItem/index.vue b/src/layouts/components/SidebarItem/index.vue index d02bee09..a220d250 100644 --- a/src/layouts/components/SidebarItem/index.vue +++ b/src/layouts/components/SidebarItem/index.vue @@ -1,6 +1,6 @@ diff --git a/src/layouts/components/views/link.vue b/src/layouts/components/views/link.vue new file mode 100644 index 00000000..61c3be63 --- /dev/null +++ b/src/layouts/components/views/link.vue @@ -0,0 +1,97 @@ + + + + + diff --git a/src/layouts/index.vue b/src/layouts/index.vue index 5364a1fc..2f40b326 100644 --- a/src/layouts/index.vue +++ b/src/layouts/index.vue @@ -1,5 +1,6 @@