Browse Source

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

pull/2169/head
贤心 3 months ago committed by GitHub
parent
commit
4c4c46fc8d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 6
      src/modules/upload.js

6
src/modules/upload.js

@ -323,7 +323,7 @@ layui.define(['lay', 'layer'], function(exports){
'Upload failed, please try again.',
'status: '+ (e.status || '') +' - '+ (e.statusText || 'error')
].join('<br>'));
error(sets.index, e.responseText);
error(sets.index, e.responseText, e);
allDone(sets.index);
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){
elemFile.value = '';
}
@ -446,7 +446,7 @@ layui.define(['lay', 'layer'], function(exports){
typeof options.error === 'function' && options.error(index || 0, function(files){
that.upload(files);
}, res);
}, res, xhr);
};
var check;

Loading…
Cancel
Save