mirror of https://github.com/layui/layui
feat(upload): 新增 `error` 回调函数的第四个参数为 xhr 对象 (#2151)
parent
a8b6b9c696
commit
4c4c46fc8d
|
@ -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;
|
||||||
|
|
Loading…
Reference in New Issue