Explorar el Código

fix bug: 切换题目是清空上一题的分数

Michael Wang hace 3 años
padre
commit
909bc4b1a1
Se han modificado 1 ficheros con 7 adiciones y 1 borrados
  1. 7 1
      src/features/mark/MarkBoardTrack.vue

+ 7 - 1
src/features/mark/MarkBoardTrack.vue

@@ -179,7 +179,7 @@
 <script setup lang="ts">
 import type { Question } from "@/types";
 import { isNumber } from "lodash";
-import { onMounted, onUnmounted } from "vue";
+import { onMounted, onUnmounted, watch } from "vue";
 import { store } from "@/store/store";
 import { autoChooseFirstQuestion } from "./use/autoChooseFirstQuestion";
 import { dragSplitPane } from "./use/splitPane";
@@ -190,6 +190,12 @@ const { dragSpliter, topPercent } = dragSplitPane();
 
 const { chooseQuestion } = autoChooseFirstQuestion();
 
+// 切换题目是清空上一题的分数
+watch(
+  () => store.currentQuestion,
+  () => (store.currentScore = undefined)
+);
+
 let questionScore = $computed(
   () =>
     store.currentTask &&