diff --git a/src/views/AiEmotion.vue b/src/views/AiEmotion.vue index 5fce74d..733be89 100644 --- a/src/views/AiEmotion.vue +++ b/src/views/AiEmotion.vue @@ -1900,7 +1900,11 @@ function isDataLoaded() { // 设置Intersection Observer监听场景应用部分 function setupIntersectionObserver() { - if (!scenarioApplicationRef.value) return; + // 检查 scenarioApplicationRef.value 是否存在且是有效的 DOM 元素 + if (!scenarioApplicationRef.value || !(scenarioApplicationRef.value instanceof Element)) { + console.warn('scenarioApplicationRef.value 不是有效的 DOM 元素,跳过 IntersectionObserver 设置'); + return; + } const observer = new IntersectionObserver( (entries) => {