From 9f91919046cc069f7b31053a2d6d43a56335cc61 Mon Sep 17 00:00:00 2001 From: suyanyan <1321717064@qq.com> Date: Thu, 18 Jul 2024 17:37:00 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/TreeFilter/index.vue | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/SafeCampus.WEB/src/components/TreeFilter/index.vue b/SafeCampus.WEB/src/components/TreeFilter/index.vue index 15d5df7..254e30a 100644 --- a/SafeCampus.WEB/src/components/TreeFilter/index.vue +++ b/SafeCampus.WEB/src/components/TreeFilter/index.vue @@ -56,6 +56,7 @@ interface TreeFilterProps { topName?: string; // 顶级分类名称 ==> 非必传,默认为 “全部” showAll?: boolean; // 是否显示全部选项 ==> 非必传,默认为 true width: string; + isData?: boolean; } const props = withDefaults(defineProps(), { id: "id", @@ -65,7 +66,8 @@ const props = withDefaults(defineProps(), { defaultExpandLevel: 1, checkStrictly: false, topName: "全部", - showAll: true + showAll: true, + isData: false }); const defaultProps = { @@ -156,13 +158,17 @@ const refresh = async () => { treeRef.value?.setCheckedKeys([]); treeRef.value?.setCurrentKey(""); setSelected(); - await getRequestData(); + if (!props.isData) { + await getRequestData(); + } }; const getRequestData = async () => { - const { data } = await props.requestApi!(); - treeData.value = data; - setTreeAllData(data); + if (!props.isData) { + const { data } = await props.requestApi!(); + treeData.value = data; + setTreeAllData(data); + } }; /** 获取默认展开层级 */