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) => {
>
-
+
{
>
-
+