<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
相关推荐
麦麦麦当劳大王7 小时前
【油猴脚本】Boss直聘 岗位职责复制只睡四小时8 小时前
Three.js Sub-tick:漏判 60.7%→0excel9 小时前
基于 GPT 的自动发布文章接口方案:从一句话或一张图片生成并发布内容OpsEye15 小时前
大模型 Token 计量不准,是什么原因,怎么解决??独隅16 小时前
WebStorm Windows 版 React / Next.js 实战替换指南冷眸_16 小时前
同名食材不能直接相减:一个 JavaScript 用量模型的边界ruanno_top17 小时前
倒计时该用 deadline 还是每秒减一?我把两种写法都跑了一遍apollo_qwe17 小时前
接口超时了,前端为什么不能直接重试?徐小夕21 小时前
下载量超 30 万的开源智能体 Prime Agent:它把自己从 TypeScript 重写成了 Rust用户03321266636721 小时前
使用 Python 在 Excel 文档中添加水印