From 2da0d098b96c0da7d76def21bc78fc3b92dc88d8 Mon Sep 17 00:00:00 2001 From: yuetsh <517252939@qq.com> Date: Mon, 29 Jun 2026 06:27:14 -0600 Subject: [PATCH] fix --- src/oj/problem/detail.vue | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/src/oj/problem/detail.vue b/src/oj/problem/detail.vue index 6f41912..fd6e9dd 100644 --- a/src/oj/problem/detail.vue +++ b/src/oj/problem/detail.vue @@ -6,12 +6,11 @@ import { useProblemStore } from "oj/store/problem" import { useScreenModeStore } from "shared/store/screenMode" import { useMyFlowchartStore } from "shared/store/myFlowchart" -const ProblemEditor = defineAsyncComponent( - () => import("./components/ProblemEditor.vue"), -) -const ContestEditor = defineAsyncComponent( - () => import("./components/ContestEditor.vue"), -) +// 抽成具名 loader,便于进页面时与接口并行预取编辑器 chunk +const loadProblemEditor = () => import("./components/ProblemEditor.vue") +const loadContestEditor = () => import("./components/ContestEditor.vue") +const ProblemEditor = defineAsyncComponent(loadProblemEditor) +const ContestEditor = defineAsyncComponent(loadContestEditor) const EditorForTest = defineAsyncComponent( () => import("./components/EditorForTest.vue"), ) @@ -106,6 +105,9 @@ watch( async function init() { screenModeStore.resetScreenMode() + // 并行预取右侧编辑器 chunk(CodeMirror ~370K+), + // 避免等 getProblem 返回后才串行下载,编辑器才迟迟出现 + ;(inProblem.value ? loadProblemEditor : loadContestEditor)() try { const res = await getProblem(problemID, contestID) problem.value = res.data @@ -153,11 +155,7 @@ watch(isMobile, (value) => { > - + { > - +