diff --git a/src/views/Admin.vue b/src/views/Admin.vue index 4f56fa8..8762f01 100644 --- a/src/views/Admin.vue +++ b/src/views/Admin.vue @@ -2554,11 +2554,10 @@ watch(questionGroup, () => { if (activeMenu.value === 'questions') refreshQuestionData(true) }) -// R29:成绩管理页切组 → 刷新成绩明细 + 两个由试卷管理迁入的板块 -// (这两个板块的组别跟随 scoreExportGroup,故其刷新必须挂在这里) -watch(scoreExportGroup, () => { - if (activeMenu.value === 'scores') refreshExamCtxData(true) -}) +// ⚠️ R29 修复:此处原有一条 `watch(scoreExportGroup, …)`,已下移到 `scoreExportGroup` +// 声明之后(见「6. 成绩管理」节)。原因:watch() 会**立即执行一次取值**来收集依赖, +// 若写在 ref 声明之前,setup 阶段即抛 +// `ReferenceError: Cannot access 'scoreExportGroup' before initialization`(TDZ)。 // ==================== 3.5 备赛资料管理 ==================== const materialsGroup = ref('benke') @@ -2814,6 +2813,15 @@ const scoreExportGroup = ref('') * 本科 / 教师组提交的是 Word / PPT 作品,没有客观题与综合大题数据。 */ const isExamScoreGroup = computed(() => scoreExportGroup.value === 'zhongzhi' || scoreExportGroup.value === 'gaozhi') + +// R29:成绩管理页切组 → 刷新成绩明细 + 两个由试卷管理迁入的板块 +// (这两个板块的组别跟随 scoreExportGroup,故其刷新必须挂在这里) +// 🔴 必须写在 `scoreExportGroup` 声明**之后**:watch() 会立即取值收集依赖, +// 前置引用会在 setup 阶段触发 TDZ(Cannot access 'scoreExportGroup' before initialization)。 +watch(scoreExportGroup, () => { + if (activeMenu.value === 'scores') refreshExamCtxData(true) +}) + const scoreList = ref([]) const scoreListLoading = ref(false) const scoreListPage = ref(1)