最近搜索

js点击事件 传id 传字符串也行

浏览:160
管理员 2024-03-31 03:31




js 点击事件 传参数





js点击事件 传id  


function  select(priceSheetId){
   console.log(priceSheetId);
}

function  load_data(){
   console.log(`${biaozhun}  ${guige}`);
   $.post("/admin/price/sheet/search", {biaozhun:biaozhun,guige:guige
   }, function(result) {
      if (result.success) {
         result.priceSheetList.forEach((priceSheet)=>{
             $("table#priceSheetList tbody ").append("<tr>\n" +
                   "\t\t\t\t\t<td>"+priceSheet.biaoZhun.bianhao+"</td>\n" +
                   "\t\t\t\t\t<td>"+priceSheet.biaoZhun.biaozhun+"</td>\n" +
                   "\t\t\t\t\t<td>"+priceSheet.biaoZhun.guige+"</td>\n" +
                   "\t\t\t\t\t<td>"+priceSheet.type+"</td>\n" +
                   "\t\t\t\t\t<td>"+priceSheet.price+"</td>\n" +
                   "\t\t\t\t\t<td>"+priceSheet.priceSheetHead.title+"</td>\n" +
                   "\t\t\t\t\t<td>  <button type=\"button\" onclick='select("+priceSheet.id+")' class=\"layui-btn layui-btn-xs\">选择</button></td>\n" +
                   "\t\t\t\t</tr>");

         });
         // map.put("priceSheetList", priceSheetList);
         // map.put("priceSheetHead", priceSheetHead);
         // map.put("priceSheetHeadList", priceSheetHeadList);
      } else {
         layer.msg(result.msg);
      }
   }, 'json');
}




这是传递字符串参数。


function  load_data(){
   console.log(`${biaozhun}  ${guige}`);
   $.post("/admin/price/sheet/search", {biaozhun:biaozhun,guige:guige
   }, function(result) {
      if (result.success) {
         result.priceSheetList.forEach((priceSheet)=>{
             $("table#priceSheetList tbody ").append("<tr>\n" +
                   "\t\t\t\t\t<td>"+priceSheet.biaoZhun.bianhao+"</td>\n" +
                   "\t\t\t\t\t<td>"+priceSheet.biaoZhun.biaozhun+"</td>\n" +
                   "\t\t\t\t\t<td>"+priceSheet.biaoZhun.guige+"</td>\n" +
                   "\t\t\t\t\t<td>"+priceSheet.type+"</td>\n" +
                   "\t\t\t\t\t<td>"+priceSheet.price+"</td>\n" +
                   "\t\t\t\t\t<td>"+priceSheet.priceSheetHead.title+"</td>\n" +
                   ' <td>  <button type="button" onclick="select(\''+priceSheet.priceSheetHead.filePath+'\')" class="layui-btn layui-btn-xs">选择</button></td> ' +
                   "\t\t\t\t</tr>");

         });
         // map.put("priceSheetList", priceSheetList);
         // map.put("priceSheetHead", priceSheetHead);
         // map.put("priceSheetHeadList", priceSheetHeadList);
      } else {
         layer.msg(result.msg);
      }
   }, 'json');
}

function  select(priceSheetId){
   console.log(priceSheetId);
}


联系站长

站长微信:xiaomao0055

站长QQ:14496453