js-table2excel的使用
- 安装
yarn add js-table2excel / npm install js-table2excel
- 引入
import table2excel from 'js-table2excel'
- 使用
onBatchExport() { //导出按钮
const column = [
{ title: '品牌名称', key: 'tmName', type: 'text' },
{ title: '品牌LOGO', key: 'logoUrl', type: 'image', width: 50, height: 50 }
]
let tableDatas = JSON.parse(JSON.stringify(this.list))
table2excel(column, tableDatas, 'excel表格')
}