refactor: improving the readability

This commit is contained in:
likui628 2024-04-02 16:25:35 +08:00
parent b28a46edcb
commit 6528dc45df
1 changed files with 7 additions and 7 deletions

View File

@ -191,13 +191,13 @@
const { data } = ret; const { data } = ret;
item.status = UploadResultStatus.SUCCESS; item.status = UploadResultStatus.SUCCESS;
item.response = data; item.response = data;
if(props.resultField){ if (props.resultField) {
// //
item.response = { item.response = {
code:0, code: 0,
message:"upload Success!", message: 'upload Success!',
url:get(ret, props.resultField) url: get(ret, props.resultField),
} };
} }
return { return {
success: true, success: true,
@ -216,7 +216,7 @@
// //
async function handleStartUpload() { async function handleStartUpload() {
const { maxNumber } = props; const { maxNumber } = props;
if ((fileListRef.value.length + props.previewFileList?.length ?? 0) > maxNumber) { if (fileListRef.value.length + props.previewFileList.length > maxNumber) {
return createMessage.warning(t('component.upload.maxNumber', [maxNumber])); return createMessage.warning(t('component.upload.maxNumber', [maxNumber]));
} }
try { try {
@ -250,7 +250,7 @@
return createMessage.warning(t('component.upload.saveWarn')); return createMessage.warning(t('component.upload.saveWarn'));
} }
const fileList: string[] = []; const fileList: string[] = [];
for (const item of fileListRef.value) { for (const item of fileListRef.value) {
const { status, response } = item; const { status, response } = item;
if (status === UploadResultStatus.SUCCESS && response) { if (status === UploadResultStatus.SUCCESS && response) {