Browse Source

fix:直接go會導致路由跳轉失效

Cyt928 5 years ago
parent
commit
04ce6fb8b3
1 changed files with 5 additions and 2 deletions
  1. 5 2
      src/composable/useProject.ts

+ 5 - 2
src/composable/useProject.ts

@@ -12,8 +12,11 @@ export const useProjectList = () => {
 
   const handleProjectChange = (projectId: number) => {
     WorkspaceDispatcher.changeProject(projectId);
-    router.push(`/project/${projectId}/schedule`);
-    router.go(0);
+    if (router.currentRoute.value.path.includes('schedule')) {
+      router.go(0);
+    } else {
+      router.push(`/project/${projectId}/schedule`);
+    }
   };
   return {
     projectList,