【轉】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