【转】layui.upload上传文件的同时怎么传递一个参数呢?


原文地址:https://fly.layui.com/jie/8420/

原文地址:https://fly.layui.com/jie/7573/

一:post方法上传

layui 2.1.0 标记下

before: function(obj){ 
layer.load(); //上传loading
this.data={'xxx':'xxx'};
}

另一种方法

封装的函数如下:
function extra_data(input,data){
    var item=[];
    $.each(data,function(k,v){
        item.push('<input type="hidden" name="'+k+'" value="'+v+'">');
    })
    $(input).after(item.join(''));
}

使用方法:

 二:get

  
 before: function (obj) {
     this.url = ApiUrl + '/api/XXX/UpLoadImage?StockId=' + stockId ;
 }

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM