fix
This commit is contained in:
@@ -47,10 +47,19 @@ async function loadSimilarProblems() {
|
||||
similarLoaded.value = true
|
||||
}
|
||||
|
||||
// 切换题目时重置相似推荐状态
|
||||
watch(
|
||||
() => problem.value?._id,
|
||||
() => {
|
||||
similarProblems.value = []
|
||||
similarLoaded.value = false
|
||||
},
|
||||
)
|
||||
|
||||
// AC 或失败次数 >= 3 时加载推荐
|
||||
watch(
|
||||
() => [problem.value?.my_status, problemStore.totalFailCount],
|
||||
([status, failCount]) => {
|
||||
() => [problem.value?._id, problem.value?.my_status, problemStore.totalFailCount],
|
||||
([, status, failCount]) => {
|
||||
if (status === 0 || (failCount as number) >= 3) {
|
||||
loadSimilarProblems()
|
||||
}
|
||||
|
||||
@@ -104,6 +104,7 @@ async function init() {
|
||||
}
|
||||
}
|
||||
onMounted(init)
|
||||
watch(() => props.problemID, init)
|
||||
onBeforeUnmount(() => {
|
||||
problem.value = null
|
||||
errMsg.value = "无数据"
|
||||
|
||||
Reference in New Issue
Block a user