<div style="display: none"> <table id="table"> </table> </div> <button class="layui-btn" id="export"> <i class="iconfont icon-export"></i> 导出 </button>
$(".export").click(function(){ var ins1=table.render({ elem: '#data_export', url: "url", //数据接口 method: 'post', title: '表名', where: { mycode: "all" }, limit: 10, cols: [[ {field: 'id', title: 'ID'}, {field: 'name', title: '名字'}, ]], done: function (res, curr, count) { exportData=res.data; table.exportFile(ins1.config.id,exportData, 'xls'); } }); })
有问题请联系作者QQ:4505399(备注:vb盒子)