Skip to content
  • Projects
  • Groups
  • Snippets
  • Help

monorepo / venus

  • This project
    • Loading...
  • Sign in
Go to a project
  • Project
  • Repository
  • Issues 1
  • Merge Requests 0
  • Pipelines
  • Wiki
  • Settings
  • Activity
  • Graph
  • Charts
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Files
  • Commits
  • Branches
  • Tags
  • Contributors
  • Graph
  • Compare
  • Charts
Switch branch/tag
  • venus
  • ..
  • menu
  • use-navigation.ts
  • vince's avatar
    refactor(project): re-adjust the overall folder · 14538f7e
    vince committed Jul 23, 2024
    14538f7e
use-navigation.ts 383 Bytes
RawBlameHistoryPermalink
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
import { useRouter } from 'vue-router';

import { isHttpUrl, openWindow } from '@vben/utils';

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 };