From e036c88535b16b766a8dbffe6226a533ebd2bdbf Mon Sep 17 00:00:00 2001 From: wangqiao Date: Sat, 30 Aug 2025 11:06:12 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E4=BC=98=E5=8C=96=E5=A3=81?= =?UTF-8?q?=E7=BA=B8=E5=88=86=E7=B1=BB=E7=BB=84=E4=BB=B6=E5=8F=82=E6=95=B0?= =?UTF-8?q?=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/kl-wallpaper-category/index.vue | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/components/kl-wallpaper-category/index.vue b/components/kl-wallpaper-category/index.vue index 5fedfbd..b77db45 100644 --- a/components/kl-wallpaper-category/index.vue +++ b/components/kl-wallpaper-category/index.vue @@ -83,9 +83,9 @@ return props.type === 1 ? '图纸' : props.type === 3 ? '模型' : '文本' }) - const handleParentId = (type?: string) => { + const handleParentId = () => { if (level?.value?.length > 1) { - if (type === 'init' && level.value.find((c: any) => c.isChildren)) { + if (level.value.find((c: any) => c.isChildren)) { return level.value[level.value.length - 2].id || '' // 获取最后一个元素的 id 或 defaul } return level.value[level.value.length - 1].id || '' // 获取最后一个元素的 id 或 defaul @@ -130,11 +130,9 @@ console.log('breadList', breadList); - /** 是否是初始化 */ - const queryType = ref('init') /**获取分类下拉框 */ const { data: projectTypeList, refresh } = useAsyncData(`projectType-draw-${props.type}-${Date.now()}`, async () => { - const res = await parent({ type: 1, parentId: handleParentId(queryType.value) }) + const res = await parent({ type: 1, parentId: handleParentId() }) const all = [{ id: '-1', name: '全部' }] return [...all, ...res.data] }) @@ -159,7 +157,6 @@ } else { level.value.push({ id: row.id, name: row.name }) // getParent() - queryType.value = '' refresh() } } @@ -169,7 +166,6 @@ query.value.title = '' query.value.projectType = row.id // getParent() - queryType.value = '' refresh() }