perf: 优化菜单

This commit is contained in:
xiaojunnuo
2024-10-20 03:00:55 +08:00
parent d6b91b38f0
commit 1f4f15757d
7 changed files with 75 additions and 37 deletions
@@ -0,0 +1,25 @@
import router from "/@/router";
async function open(path: any) {
if (path == null) {
return;
}
if (path.startsWith("http://") || path.startsWith("https://")) {
window.open(path);
return;
}
try {
const navigationResult = await router.push(path);
if (navigationResult) {
// 导航被阻止
} else {
// 导航成功 (包括重新导航的情况)
}
} catch (e) {
console.error("导航失败", e);
}
}
export const routerUtils = {
open
};