步骤:感觉没啥问题,不过导出的表格样式没有生效
var table_dom = this.$refs['table1'].$el;
const new_book = XLSX.utils.book_new();
const new_sheet = XLSX.utils.table_to_sheet(table_dom);
new_sheet['A1'].s = {
font: {
name: '宋体',
sz: 24,
bold: true,
color: { rgb: '#ff9900', auto: 1}
},
alignment: { horizontal: 'center', vertical: 'center', wrapText: true },
fill: {
bgcolor: { rgb: "#ffff00", auto: 1 }
}
}
XLSX.utils.book_append_sheet(new_book, new_sheet, '元器件仓库日报汇总');
XLSX.writeFile(new_book, '元器件出入库报表.xls')
已解决,有需要的同学可以去我的博客资源下载中免费下载。