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)