From 58e675c996821ba089f87d3c0f0b31529f806773 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B4=A4=E5=BF=83?= <3277200+sentsim@users.noreply.github.com> Date: Fri, 8 Sep 2023 23:42:28 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=20upload=20=E7=9A=84=20dataT?= =?UTF-8?q?ype=20=E5=B1=9E=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/upload.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/modules/upload.js b/src/modules/upload.js index 41992d4c..21bab6ef 100644 --- a/src/modules/upload.js +++ b/src/modules/upload.js @@ -236,7 +236,6 @@ layui.define(['lay','layer'], function(exports){ data: formData, contentType: false, processData: false, - // dataType: 'json', headers: options.headers || {}, success: function(res){ // 成功回调 options.unified ? (successful += that.fileLength) : successful++; @@ -253,6 +252,12 @@ layui.define(['lay','layer'], function(exports){ allDone(); } }; + // dataType + if (options.dataType) { + opts.dataType = options.dataType; + } else if (options.force === 'json') { + opts.dataType = options.force; + } // 进度条 if(typeof options.progress === 'function'){ opts.xhr = function(){