瀏覽代碼

fix 考试与作业页面切换状态要重置

Michael Wang 3 年之前
父節點
當前提交
12a4f7b098
共有 1 個文件被更改,包括 8 次插入0 次删除
  1. 8 0
      src/features/OnlineExam/OnlineExamList.vue

+ 8 - 0
src/features/OnlineExam/OnlineExamList.vue

@@ -7,6 +7,8 @@ import { tryLimit } from "@/utils/tryLimit";
 import { useTimers } from "@/setups/useTimers";
 import { WEEKDAY_NAMES } from "@/constants/constants";
 import OnlineExamResultList from "./OnlineExamResultList.vue";
+import { useRoute } from "vue-router";
+import { watch } from "vue";
 
 const {
   courses = [],
@@ -18,9 +20,15 @@ const {
   examType?: ExamType;
 }>();
 
+const route = useRoute();
+
 let selectedCourse: OnlineExam | null = $ref(null);
 let selectExamState: "EXAMING" | "EXAM_END" = $ref("EXAMING");
 
+watch(route, () => {
+  selectExamState = "EXAMING";
+});
+
 const selectedCourseList = $computed(() =>
   selectExamState === "EXAMING" ? courses : endCourses
 );