cc hai 2 semanas
pai
achega
9882b2f62b
Modificáronse 1 ficheiros con 7 adicións e 6 borrados
  1. 7 6
      ai-frontend/src/case/views/data/cleaning.vue

+ 7 - 6
ai-frontend/src/case/views/data/cleaning.vue

@@ -476,12 +476,6 @@
       templatePreviewRequestToken += 1;
     }
   });
-  watch(categories, (nextCategories) => {
-    if (!nextCategories.includes(activeCategory.value)) {
-      activeCategory.value = DEFAULT_TEMPLATE_CATEGORY;
-    }
-  });
-
   const activeNodeInfo = computed(() => {
     return activeNodeKey.value ? findTreeNodeByKey(treeData.value, activeNodeKey.value)?.raw || null : null;
   });
@@ -748,6 +742,13 @@
     templateSearchBaseList,
   } = templateApi;
 
+  // categories 依赖 templateApi 解构出的 ref,必须在解构之后注册,否则 setup 期首次求值触发 TDZ 报错
+  watch(categories, (nextCategories) => {
+    if (!nextCategories.includes(activeCategory.value)) {
+      activeCategory.value = DEFAULT_TEMPLATE_CATEGORY;
+    }
+  });
+
   // 既有域:mappingApi
   const mappingApi = useFieldMapping({
     activeNodeInfo,