mirror of
https://github.com/vbenjs/vue-vben-admin.git
synced 2025-08-24 15:26:15 +08:00
feat(other): The menu supports jumping to external links and fixing some known problems
This commit is contained in:
19
packages/business/layouts/src/basic/menu/use-navigation.ts
Normal file
19
packages/business/layouts/src/basic/menu/use-navigation.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
import { isHttpUrl, openWindow } from '@vben-core/toolkit';
|
||||
|
||||
import { useRouter } from 'vue-router';
|
||||
|
||||
function useNavigation() {
|
||||
const router = useRouter();
|
||||
|
||||
const navigation = async (path: string) => {
|
||||
if (isHttpUrl(path)) {
|
||||
openWindow(path, { target: '_blank' });
|
||||
} else {
|
||||
await router.push(path);
|
||||
}
|
||||
};
|
||||
|
||||
return { navigation };
|
||||
}
|
||||
|
||||
export { useNavigation };
|
Reference in New Issue
Block a user