表格(table)数据导出成Excel
使用xlxs-js库
function exportExcel () { var wb = XLSX.utils.table_to_book(document.querySelector('.my-el-table')) var wbout = XLSX.write(wb, { bookType: 'xlsx', bookSST: true, type: 'array' }) try { FileSaver.saveAs(new Blob([wbout], { type: 'application/octet-stream' }), 'userlist.xlsx') } catch (e) { if (typeof console !== 'undefined') console.log(e, wbout) } return wbout },
本文来自博客园,作者:_zhiqiu,转载请注明原文链接:https://www.cnblogs.com/guojikun/p/8984355.html