|
@@ -1,6 +1,6 @@
|
|
|
<template>
|
|
|
<template v-for="subItem in menuList" :key="subItem.path">
|
|
|
- <el-sub-menu v-if="subItem.children?.length" teleported popperClass="layout-menu-popper-wrap" :index="subItem.path">
|
|
|
+ <el-sub-menu v-if="subItem.children?.length" teleported popper-class="layout-menu-popper-wrap" :index="subItem.path">
|
|
|
<template #title>
|
|
|
<PickerIcon v-if="subItem.meta.icon" :icon-class="subItem.meta.icon" />
|
|
|
<!-- <el-icon v-if="subItem.meta.icon">
|
|
@@ -10,7 +10,7 @@
|
|
|
</template>
|
|
|
<SubMenu :menu-list="subItem.children" />
|
|
|
</el-sub-menu>
|
|
|
- <el-menu-item v-else popperClass="layout-menu-popper-wrap" :index="subItem.path" @click="handleClickMenu(subItem)">
|
|
|
+ <el-menu-item v-else popper-class="layout-menu-popper-wrap" :index="subItem.path" @click="handleClickMenu(subItem)">
|
|
|
<PickerIcon v-if="subItem.meta.icon" :icon-class="subItem.meta.icon" />
|
|
|
<!-- <el-icon>
|
|
|
<component :is="subItem.meta.icon"></component>
|
|
@@ -27,13 +27,25 @@ import { useRouter } from 'vue-router'
|
|
|
import { generateTitle } from '@/utils/i18n'
|
|
|
import PickerIcon from '@/components/IconPicker/PickerIcon.vue'
|
|
|
import { isExternal } from '@/utils/validate'
|
|
|
+import {ElMessage} from "element-plus";
|
|
|
|
|
|
defineProps<{ menuList: RouteMenu.Item[] }>()
|
|
|
|
|
|
const router = useRouter()
|
|
|
+
|
|
|
+/**
|
|
|
+ * 1、在此判断是否是外链 subItem.meta.type === 'iframe'
|
|
|
+ * 是外链,则直接跳转(先不考虑在框架中打开外链)
|
|
|
+ * 否则跳转路由
|
|
|
+ * @param subItem
|
|
|
+ */
|
|
|
const handleClickMenu = (subItem: RouteMenu.Item) => {
|
|
|
- if (isExternal(subItem.path)) return window.open(subItem.path, '_blank')
|
|
|
- router.push(subItem.path)
|
|
|
+ if (subItem.meta.type === 'iframe') {
|
|
|
+ if (!isExternal(subItem.path)) return ElMessage.error(`当前路由 ${subItem.path} 不是外链地址,请检查配置~`)
|
|
|
+ return window.open(subItem.path, '_blank')
|
|
|
+ } else {
|
|
|
+ router.push(subItem.path)
|
|
|
+ }
|
|
|
// router.push({ name: subItem.name })
|
|
|
// router.push('/404')
|
|
|
}
|