From fccc3a361b030c296eebdd446dc27e6f6ab8c3cc Mon Sep 17 00:00:00 2001 From: yuetsh <517252939@qq.com> Date: Mon, 6 Oct 2025 00:06:25 +0800 Subject: [PATCH] fix --- src/App.vue | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/App.vue b/src/App.vue index bacd66d..1cfb4cd 100644 --- a/src/App.vue +++ b/src/App.vue @@ -6,9 +6,9 @@ import "./index.css" const isDark = useDark() // 延迟加载 highlight.js,避免阻塞首屏 -let hljsInstance: any = null +const hljsInstance = ref(null) const loadHighlightJS = async () => { - if (hljsInstance) return hljsInstance + if (hljsInstance.value) return hljsInstance.value const hljs = (await import("highlight.js/lib/core")).default const c = (await import("highlight.js/lib/languages/c")).default @@ -19,7 +19,7 @@ const loadHighlightJS = async () => { hljs.registerLanguage("python", python) hljs.registerLanguage("cpp", cpp) - hljsInstance = hljs + hljsInstance.value = hljs return hljs } @@ -32,10 +32,7 @@ onMounted(() => { } }) -provide( - "hljs", - computed(() => hljsInstance), -) +provide("hljs", hljsInstance)