mirror of https://github.com/layui/layui
修改 upload 组件表单域的顺序
parent
e08932d935
commit
fea4c75650
|
@ -194,14 +194,15 @@ layui.define('layer' , function(exports){
|
||||||
layui.each(items, function(index, file){
|
layui.each(items, function(index, file){
|
||||||
var formData = new FormData();
|
var formData = new FormData();
|
||||||
|
|
||||||
formData.append(options.field, file);
|
|
||||||
|
|
||||||
//追加额外的参数
|
//追加额外的参数
|
||||||
layui.each(options.data, function(key, value){
|
layui.each(options.data, function(key, value){
|
||||||
value = typeof value === 'function' ? value() : value;
|
value = typeof value === 'function' ? value() : value;
|
||||||
formData.append(key, value);
|
formData.append(key, value);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
//最后添加 file 到表单域
|
||||||
|
formData.append(options.field, file);
|
||||||
|
|
||||||
//提交文件
|
//提交文件
|
||||||
var opts = {
|
var opts = {
|
||||||
url: options.url
|
url: options.url
|
||||||
|
|
Loading…
Reference in New Issue