2024-05-21 21:45:48 +08:00
|
|
|
import { useRouter } from 'vue-router';
|
|
|
|
|
2024-06-08 19:49:06 +08:00
|
|
|
import { isHttpUrl, openWindow } from '@vben-core/toolkit';
|
|
|
|
|
2024-05-21 21:45:48 +08:00
|
|
|
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 };
|