From 359c6a19f13c5835b45c2582f57ef254a1d04875 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B4=A4=E5=BF=83?= <3277200+sentsim@users.noreply.github.com> Date: Thu, 14 Sep 2023 23:31:45 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=20upload=20=E7=9A=84=20`data?= =?UTF-8?q?Type`=20=E5=B1=9E=E6=80=A7=E5=80=BC=E9=BB=98=E8=AE=A4=E4=B8=BA?= =?UTF-8?q?=20`json`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/upload.js | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/modules/upload.js b/src/modules/upload.js index 68fb69c3..7ce90b7f 100644 --- a/src/modules/upload.js +++ b/src/modules/upload.js @@ -256,6 +256,7 @@ layui.define(['lay','layer'], function(exports){ url: options.url, type: 'post', // 统一采用 post 上传 data: formData, + dataType: options.dataType || 'json', contentType: false, processData: false, headers: options.headers || {}, @@ -274,12 +275,7 @@ 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(){