Browse Source

新增 upload 的 dataType 属性

pull/1368/head
贤心 1 year ago
parent
commit
58e675c996
  1. 7
      src/modules/upload.js

7
src/modules/upload.js

@ -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(){

Loading…
Cancel
Save