示例1:
我的gethub。
示例2:
<html>
<head>
<p style="font-size: 20px;color: red;">使用table标签方式将json导出xls文件</p>
<button onclick='tableToExcel()'>导出</button>
</head>
<body>
<script>
const tableToExcel = () => {
// 要导出的json数据
const jsonData = [{
name: '路人甲',
phone: '123456',
email: '[email protected]'
}, {
name: '炮灰乙',
phone: '123456',
email: '[email protected]'
}, {
name: '土匪丙',
phone: '123456',
email: '[email protected]'
}, {
name: '流氓丁',
phone: '123456',
email: '[email protected]'
}]
// 列标题
let