新增 upload 的 dataType 属性

pull/1368/head
贤心 2023-09-08 23:42:28 +08:00
parent 60c1ef770a
commit 58e675c996
1 changed files with 6 additions and 1 deletions

View File

@ -236,7 +236,6 @@ layui.define(['lay','layer'], function(exports){
data: formData, data: formData,
contentType: false, contentType: false,
processData: false, processData: false,
// dataType: 'json',
headers: options.headers || {}, headers: options.headers || {},
success: function(res){ // 成功回调 success: function(res){ // 成功回调
options.unified ? (successful += that.fileLength) : successful++; options.unified ? (successful += that.fileLength) : successful++;
@ -253,6 +252,12 @@ layui.define(['lay','layer'], function(exports){
allDone(); allDone();
} }
}; };
// dataType
if (options.dataType) {
opts.dataType = options.dataType;
} else if (options.force === 'json') {
opts.dataType = options.force;
}
// 进度条 // 进度条
if(typeof options.progress === 'function'){ if(typeof options.progress === 'function'){
opts.xhr = function(){ opts.xhr = function(){