js 点击事件 传参数
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