/** * 根据用户选择的不同规格选项 * 返回 不同的输入框选项 */ function ajaxGetSpecInput2(spec_arr) { var goods_id = $(‘#goods_id‘).val(); if (typeof(goods_id) == "undefined") { goods_id = ‘‘; } $.ajax({ type:‘POST‘, data:{‘spec_arr‘:spec_arr}, url:"/index.PHP/admin/Goods/ajaxGetSpecInput/goods_id/"+goods_id, success:function(data){ $("#goods_spec_table2").html(‘‘); $("#goods_spec_table2").append(data); hbdyg(); // 合并单元格 layui.use([‘form‘,‘upload‘],function(){ var $ = layui.jquery,upload = layui.upload; upload.render({ elem: ‘.demoMore‘,url: "{:url(‘Upload/upload‘)}",before: function(){ },done: function(res,index,upload){ console.log(res); var item = this.item; var getId=item.context.id; $(‘#up_img‘+getId).attr(‘src‘,res.data); $(‘#up_img_url‘+getId).val(res.data); } }) }); } }); }
在append 结束后,upload.render()就可以了