<el-button
type="warning"
icon="el-icon-download"
size="small"
@click="onBatchExport"
>
导出
</el-button>
安装插件
npm install js-table2excel
导入插件
import table2excel from 'js-table2excel'
data(){
return {
listDatanew: []
}
}
// 导出事件 datas是接口返回的数据
onBatchExport() {
const column = [
{
title: '姓名',
key: 'name',
type: 'text'
},
{
title: '年龄',
key: 'age',
type: 'text'
},
{
title: '巡检时间',
key: 'XJDATE',
type: 'text'
},
{
title: '问题描述',
key: 'PROBLEM',
type: 'text'
},
{
title: '图片1',
key: 'IMG1',
type: 'image',
width: 50,
height: 50
},
{
title: '图片2',
key: 'IMG2',
type: 'image',
width: 50,
height: 50
},
]
let tableDatas = JSON.parse(JSON.stringify(this.listDatanew))
let datas = tableDatas;
table2excel(column, datas, '导出后的文件名')
},
vue table表格导出图片到Excel
ratel️2023-11-04 12:21
相关推荐
To_OC8 小时前
LC 994 腐烂的橘子:人人都说是 BFS 入门题,我却写了三遍才过如果超人不会飞12 小时前
脉络清晰的业务演进:TinyVue Timeline 时间线组件全方位实战指南如果超人不会飞12 小时前
从扁平到立体:掌握 TinyVue Grid 树形表格的高级实战指南To_OC13 小时前
LC 200 岛屿数量:经典 DFS 入门题,我第一次写居然连方向都搞错了用户21366100357215 小时前
Vue2组件化开发与父子通信用户21366100357215 小时前
Vue2事件系统与指令进阶labixiong15 小时前
实现一个能跑的迷你版Promise(一)逸铭19 小时前
Day 5:三栏布局——左账号 / 中聊天 / 右工具用户17335980753720 小时前
Vue 3 SPA 首屏优化:从 3s 到 1.2s 的 5 个实践weedsfly20 小时前
还在用 Axios?你可能需要重新理解 XHR 与 Fetch