<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 小时前
油猴脚本创建webworker踩坑记录山河木马13 小时前
渲染管线-计算得到gl_Position(顶点着色器)之后续GPU流程竹林81813 小时前
用 The Graph 查询链上数据实战:从手搓 RPC 到 Subgraph,我的 NFT 项目数据加载快了 10 倍kyriewen16 小时前
别再每次都 Google 了:我整理了前端日常最常踩的 10 个 Git 坑,附速查表SmartBoyW17 小时前
深入ECMAScript规范:彻底搞懂JS隐式类型转换与底层ToPrimitive机制咪库咪库咪17 小时前
vue3-组件用户8524950718417 小时前
解密 JavaScript 中的 this:谁才是真正的调用者?10share17 小时前
100行代码 模拟实现Vue 响应式系统Heo17 小时前
Vite进阶用法详解铁皮饭盒19 小时前
Next.js 风格路由内置?Bun FileSystemRouter 凭啥这么香