From 3f7e4f5dc89127eeab326fbc4b31a545f515a376 Mon Sep 17 00:00:00 2001
From: wupengfei <834520024@qq.com>
Date: 星期一, 20 十月 2025 15:24:15 +0800
Subject: [PATCH] fix: bug
---
packages/hooks/area.ts | 20 ++++++++++++++++++--
1 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/packages/hooks/area.ts b/packages/hooks/area.ts
index 7cca58c..506b61d 100644
--- a/packages/hooks/area.ts
+++ b/packages/hooks/area.ts
@@ -5,6 +5,7 @@
import Taro, { EventChannel } from '@tarojs/taro';
import { useDictionaryDataSelect } from './dic';
import axios from 'axios';
+import * as dictionaryServices from '@12333/services/apiV2/dictionary';
export function useArea() {
const queryClient = useQueryClient();
@@ -38,9 +39,24 @@
export function useAreaTree(options = {} as UseAreaTreeOptions) {
const { maxLayer = AreaType.Area } = options;
- const { areaList } = useAllAreaList();
+ // const { areaList } = useAllAreaList();
- const areaTree = computed(() => formatAreaListToTree(areaList.value, null, unref(maxLayer)));
+ const { data: areaTree } = useQuery({
+ queryKey: ['dictionaryServices/getAreaSelect', maxLayer],
+ queryFn: () => {
+ return dictionaryServices.getAreaSelect(
+ {
+ maxDeep: unref(maxLayer),
+ },
+ { showLoading: false }
+ );
+ },
+ placeholderData: () => [] as API.GetAreaSelectQueryResultOption[],
+ staleTime: Infinity,
+ });
+
+ // const areaTree = computed(() => formatAreaListToTree(areaList.value, null, unref(maxLayer)));
+ console.log('areaTree: ', areaTree);
return { areaTree: areaTree };
}
--
Gitblit v1.9.1