From 3e68d4f7fea1022e7a79c6fadf037408ef6991d3 Mon Sep 17 00:00:00 2001 From: xingyu Date: Tue, 10 Oct 2023 10:51:20 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=B6=88=E9=99=A4=E7=BB=91=E5=AE=9A?= =?UTF-8?q?=E5=B1=9E=E6=80=A7=E7=9A=84=E7=B1=BB=E5=9E=8B=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Form/src/components/ApiTree.vue | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/components/Form/src/components/ApiTree.vue b/src/components/Form/src/components/ApiTree.vue index 3e30b36..3a34b14 100644 --- a/src/components/Form/src/components/ApiTree.vue +++ b/src/components/Form/src/components/ApiTree.vue @@ -2,6 +2,7 @@ import { computed, onMounted, ref, unref, useAttrs, useSlots, watch } from 'vue' import { Tree } from 'ant-design-vue' import { get } from 'lodash-es' +import type { DataNode } from 'ant-design-vue/es/tree' import { isArray, isFunction } from '@/utils/is' import { handleTree as handleTreeFn } from '@/utils/tree' import { propTypes } from '@/utils/propTypes' @@ -21,9 +22,10 @@ const emit = defineEmits(['optionsChange', 'change']) const attrs = useAttrs() const slots = useSlots() -const treeData = ref([]) +const treeData = ref([]) const isFirstLoaded = ref(false) const loading = ref(false) + const getAttrs = computed(() => { return { ...(props.api ? { treeData: unref(treeData) } : {}), @@ -87,7 +89,7 @@ async function fetch() { if (!isArray(result)) result = get(result, props.resultField) - treeData.value = (result as Recordable[]) || [] + treeData.value = (result as DataNode[]) || [] isFirstLoaded.value = true emit('optionsChange', treeData.value) }