layui.upload上传文件的同时怎么传递一个参数

2025-02-24 15:47:03
推荐回答(3个)
回答1:

在 before 回调里面 执行追加 隐藏input的操作,里面放你的参数 $('.layui-upload-file').after( '' );

回答2:

在 before 回调里面 执行追加 隐藏input的操作,里面放你的参数 $('.layui-upload-file').after( '' );
这种方式只能传递静态参数,对于select的值好像获取不到

回答3:

通过data传递的参数,是通过post传递的

layui.use('upload', function () {
var upload = layui.upload;
upload.render({
elem: '#uploadData',
url: 'uploadUrl',
accept: 'file', //普通文件
exts: 'xlsx',
data: {
'id': 123456

},

done: function (res) {
layer.msg(res.msg);
}
})
})