feat: 文件夹选择控件,默认选中当前目录 (#6720)

Refs #6012
This commit is contained in:
2024-10-15 18:21:22 +08:00 committed by GitHub
parent acf94b052b
commit 0c31ba1c5f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 11 additions and 7 deletions

View File

@ -141,7 +141,7 @@ const data = ref([]);
const loading = ref(false);
const paths = ref<string[]>([]);
const req = reactive({ path: '/', expand: true, page: 1, pageSize: 300, showHidden: true });
const selectRow = ref();
const selectRow = ref({ path: '', name: '' });
const rowRefs = ref();
const popoverVisible = ref(false);
const newFolder = ref();
@ -183,12 +183,12 @@ const selectFile = () => {
const closePage = () => {
popoverVisible.value = false;
selectRow.value = {};
selectRow.value = { path: '', name: '' };
};
const openPage = () => {
popoverVisible.value = true;
selectRow.value = {};
selectRow.value.path = props.path || '/';
rowName.value = '';
};
@ -216,7 +216,7 @@ const open = async (row: File.File) => {
}
await search(req);
}
selectRow.value = {};
selectRow.value.path = req.path;
rowName.value = '';
};
@ -230,7 +230,7 @@ const jump = async (index: number) => {
}
path = path || '/';
req.path = path;
selectRow.value = {};
selectRow.value.path = req.path;
rowName.value = '';
await search(req);
popoverVisible.value = true;
@ -286,7 +286,7 @@ const cancelFolder = (row: any) => {
data.value.shift();
row.isCreate = false;
disBtn.value = false;
selectRow.value = {};
selectRow.value.path = req.path;
rowName.value = '';
newFolder.value = '';
};

View File

@ -271,7 +271,11 @@
>
<el-input v-model="dialogData.rowData!.sourceDir">
<template #prepend>
<FileList @choose="loadDir" :dir="true"></FileList>
<FileList
@choose="loadDir"
:dir="true"
:path="dialogData.rowData!.sourceDir"
></FileList>
</template>
</el-input>
</el-form-item>