From e92db41bea17c6204c04cf544546b608687fc11d Mon Sep 17 00:00:00 2001 From: Jason <5340635+wen-jason@user.noreply.gitee.com> Date: Fri, 16 Sep 2022 10:18:01 +0800 Subject: [PATCH] =?UTF-8?q?=E7=B4=A0=E6=9D=90=E4=B8=AD=E5=BF=83=20?= =?UTF-8?q?=E5=88=86=E7=BB=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- admin/src/components/material/hook.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/admin/src/components/material/hook.ts b/admin/src/components/material/hook.ts index 79fd1646..5ff9a2e3 100644 --- a/admin/src/components/material/hook.ts +++ b/admin/src/components/material/hook.ts @@ -20,7 +20,7 @@ export function useCate(type: number) { const cateLists = ref([]) // 选中的分组id - const cateId = ref('') + const cateId = ref('') // 获取分组列表 const getCateLists = async () => { @@ -39,6 +39,9 @@ export function useCate(type: number) { ] cateLists.value = data cateLists.value.unshift(...item) + setTimeout(() => { + treeRef.value?.setCurrentKey(cateId.value) + }, 0) } // 添加分组 @@ -66,6 +69,7 @@ export function useCate(type: number) { const handleDeleteCate = async (id: number) => { await feedback.confirm('确定要删除?') await fileCateDelete({ id }) + cateId.value = '' getCateLists() } @@ -87,7 +91,12 @@ export function useCate(type: number) { } // 处理文件的钩子函数 -export function useFile(cateId: Ref, type: Ref, limit: Ref, size: number) { +export function useFile( + cateId: Ref, + type: Ref, + limit: Ref, + size: number +) { const tableRef = shallowRef() const listShowType = ref('normal') const moveId = ref(0)