npm install xlsjs
引入xlsx.full.min.js 和export.js
<body>
<button onclick="tableExport()">导出</button>
<table id="tables">
<thead>
<tr>
<th>姓名</th>
<th>学号</th>
</tr>
</thead>
<tbody>
<tr>
<td>张三</td>
<td>123456789</td>
</tr>
<tr>
<td>李四</td>
<td>123456788</td>
</tr>
</tbody>
<tr>
<td>王五</td>
<td>123456787</td>
</tr>
</table>
<script src="../assets/js/xlsx.full.min.js"></script>
<script src="../assets/js/export.js"></script>
<script type="text/javascript">
function table