fix: 解决拖动上传文件夹错误的问题 (#3983)

This commit is contained in:
zhengkunwang 2024-02-26 18:02:11 +08:00 committed by GitHub
parent 49dcb094dc
commit 96233ee9b2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -301,7 +301,7 @@ const submit = async () => {
const chunk = file.raw.slice(start, end);
const formData = new FormData();
formData.append('filename', file.name);
formData.append('filename', getFilenameFromPath(file.name));
if (file.raw.webkitRelativePath != '') {
formData.append('path', path.value + '/' + getPathWithoutFilename(file.raw.webkitRelativePath));
} else {
@ -350,6 +350,10 @@ const getPathWithoutFilename = (path: string) => {
return path ? path.split('/').slice(0, -1).join('/') : path;
};
const getFilenameFromPath = (path) => {
return path ? path.split('/').pop() : path;
};
const acceptParams = (props: UploadFileProps) => {
path.value = props.path;
open.value = true;