Browse Source

Merge branch 'layui:main' into main

pull/1150/head
sunxiaobin89 2 years ago committed by GitHub
parent
commit
d926c85bd0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      src/modules/upload.js

5
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

Loading…
Cancel
Save