feat(upload): 新增 `error` 回调函数的第四个参数为 xhr 对象 (#2151)

pull/2169/head
贤心 2024-08-09 18:31:28 +08:00 committed by GitHub
parent a8b6b9c696
commit 4c4c46fc8d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 3 additions and 3 deletions

View File

@ -323,7 +323,7 @@ layui.define(['lay', 'layer'], function(exports){
'Upload failed, please try again.', 'Upload failed, please try again.',
'status: '+ (e.status || '') +' - '+ (e.statusText || 'error') 'status: '+ (e.status || '') +' - '+ (e.statusText || 'error')
].join('<br>')); ].join('<br>'));
error(sets.index, e.responseText); error(sets.index, e.responseText, e);
allDone(sets.index); allDone(sets.index);
resetFileState(sets.file); resetFileState(sets.file);
} }
@ -429,7 +429,7 @@ layui.define(['lay', 'layer'], function(exports){
}; };
// 统一网络异常回调 // 统一网络异常回调
var error = function(index, res){ var error = function(index, res, xhr){
if(options.auto){ if(options.auto){
elemFile.value = ''; elemFile.value = '';
} }
@ -446,7 +446,7 @@ layui.define(['lay', 'layer'], function(exports){
typeof options.error === 'function' && options.error(index || 0, function(files){ typeof options.error === 'function' && options.error(index || 0, function(files){
that.upload(files); that.upload(files);
}, res); }, res, xhr);
}; };
var check; var check;