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