From fea4c756506e7429fe70ef6b39c0b0f74726c735 Mon Sep 17 00:00:00 2001 From: Jack Date: Wed, 12 Oct 2022 13:59:10 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=20upload=20=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E8=A1=A8=E5=8D=95=E5=9F=9F=E7=9A=84=E9=A1=BA=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/upload.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/modules/upload.js b/src/modules/upload.js index 2f0cc614..0f106957 100644 --- a/src/modules/upload.js +++ b/src/modules/upload.js @@ -194,14 +194,15 @@ layui.define('layer' , function(exports){ layui.each(items, function(index, file){ var formData = new FormData(); - formData.append(options.field, file); - //追加额外的参数 layui.each(options.data, function(key, value){ value = typeof value === 'function' ? value() : value; formData.append(key, value); }); + //最后添加 file 到表单域 + formData.append(options.field, file); + //提交文件 var opts = { url: options.url