使用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 },