lsc 9 小時之前
父節點
當前提交
f2c90c885e
共有 1 個文件被更改,包括 7 次插入5 次删除
  1. 7 5
      src/views/Editor/Canvas/index.vue

+ 7 - 5
src/views/Editor/Canvas/index.vue

@@ -246,14 +246,16 @@ onMounted(() => {
   if (activeElementIdList.value.length) {
     nextTick(() => mainStore.setActiveElementIdList([]))
   }
+  // 优化:避免重复代码,统一设置 window.pptLoading
+  if (typeof window !== 'undefined') {
+    (window as any).pptLoading = 1
+  }
   if (props.courseid) {
-    // 优化暴露到 window 对象的方式,避免重复赋值
-    if (typeof window !== 'undefined') {
-      const win = window as any
-      win.pptLoading = 1
-    }
     getCourseDetail()
   }
+  else {
+    (window as any).pptLoading = 2
+  }
 })
 
 const getCourseDetail = async () => {