【issues/7706】顶部栏导航内部路由也可以支持采用新浏览器tab打开

pull/7780/head
JEECG 2025-01-16 15:00:24 +08:00
parent ab2469ff98
commit 84a7ce9b7a
1 changed files with 26 additions and 0 deletions

View File

@ -123,6 +123,13 @@
window.open(key);
return;
}
// update-begin--author:liaozhiyang---date:20250114---for:issues/7706tab
const findItem = getMatchingMenu(props.items, key);
if (findItem?.internalOrExternal == true) {
window.open(location.origin + key);
return;
}
// update-end--author:liaozhiyang---date:20250114---for:issues/7706tab
// update-end--author:liaozhiyang---date:20240402---for:QQYUN-8773
if (beforeClickFn && isFunction(beforeClickFn)) {
const flag = await beforeClickFn(key);
@ -218,6 +225,25 @@
}
return null;
}
/**
* 2025-01-14
* liaozhiyang
* 获取菜单中匹配的path所在的项
*/
const getMatchingMenu = (menus, path) => {
for (let i = 0, len = menus.length; i < len; i++) {
const item = menus[i];
if (item.path === path && !item.redirect && !item.paramPath) {
return item;
} else if (item.children?.length) {
const result = getMatchingMenu(item.children, path);
if (result) {
return result;
}
}
}
return '';
};
return {
handleMenuClick,