~~~ <!-- morris --> <script src="__PUBLIC__/js/plugins/tableexport/Blob.js"></script> <script src="__PUBLIC__/js/plugins/tableexport/FileSaver.js"></script> <script src="__PUBLIC__/js/plugins/tableexport/tableExport.js"></script> <!-- 导出xls --> <script> var export_btn = $("#export-btn"); if (export_btn) { var $exportLink = document.getElementById('export-btn'); $exportLink.addEventListener('click', function(e){ e.preventDefault(); console.log(e.target.getAttribute('data-table')); if(e.target.nodeName === "A"){ tableExport(e.target.getAttribute('data-table'), '{$title}', e.target.getAttribute('data-type')); } }, false); }; </script> ~~~ ~~~ <div class="col-sm-2" id="export-btn"> <a data-type="xls" data-table="repayment_table" href="javascript:;" type="button" class="btn btn-danger btn-sm">导出xls</a> </div> ~~~ ~~~ <div class="table-responsive"> <table class="table table-striped table-bordered table-hover dataTables-example" id="repayment_table"> <thead> <tr> <th></th> <th>编号</th> <th>借款序号</th> <th>借款人</th> <th>还款金额</th> <th>应还款时间</th> <th>实际还款时间</th> <th>是否已还</th> <th>是否逾期</th> <th>逾期费用</th> <th>操作</th> </tr> </thead> <tbody> </tbody> </table> </div> ~~~