🐛(component): 修复 upload 组件单选模式下仍传递数组的问题

This commit is contained in:
就眠儀式 2022-08-26 02:07:30 +08:00
parent 50ca7bf8c1
commit 03528f1f6d

View File

@ -181,13 +181,19 @@ const localUploadTransaction = (option: localUploadTransaction) => {
errorF(urlErrorMsg);
return;
}
if (Array.isArray(files) && files.length > 0) {
for (let i = 0; i < files.length; i++) {
let _file = files[i];
formData.append(props.field + "[" + i + "]", _file);
if (files.length > 0) {
if (props.multiple) {
//
for (let i = 0; i < files.length; i++) {
let _file = files[i];
formData.append(props.field + "[" + i + "]", _file);
}
} else {
//
formData.append(props.field, files[0]);
}
}
// Uploaddata,
//
if (props.data && props.data instanceof Object) {
let _requestDate = props.data;
for (const key in _requestDate) {