Template
1
0
mirror of https://github.com/un-pany/v3-admin-vite.git synced 2025-04-20 19:09:21 +08:00

fix: 搜索菜单项路径为外链时无法跳转 (#111)

This commit is contained in:
ClariS 2023-08-22 16:06:49 +08:00 committed by GitHub
parent ab6aa20695
commit 2cd7b161e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 1 deletions

View File

@ -8,6 +8,7 @@ import SearchFooter from "./SearchFooter.vue"
import { ElMessage, ElScrollbar } from "element-plus"
import { cloneDeep, debounce } from "lodash-es"
import { DeviceEnum } from "@/constants/app-key"
import { isExternal } from "@/utils/validate"
interface Props {
/** 控制 modal 显隐 */
@ -139,6 +140,11 @@ const handleEnter = () => {
const { length } = resultList.value
if (length === 0) return
const name = activeRouteName.value
const path = resultList.value.find((item) => item.name === name)?.path
if (path && isExternal(path)) {
window.open(path, "_blank", "noopener, noreferrer")
return
}
if (!name) {
ElMessage.warning("无法通过搜索进入该菜单,请为对应的路由设置唯一的 Name")
return

View File

@ -6,7 +6,7 @@ const Layouts = () => import("@/layouts/index.vue")
/**
*
* redirect/403/404/login Name
* redirect/403/404/login Name
*/
export const constantRoutes: RouteRecordRaw[] = [
{