<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
相关推荐
用户9385156350719 小时前
从 Prompt 到 Harness:AI 工程化的三年跃迁与实战解码木木剑光19 小时前
我开源了一个 React 组件库,沉淀了多个高频组件和实用 Hooks竹林81820 小时前
Solana DApp 开发踩坑实录:从零用 @solana/web3.js 实现链上数据查询与交易签名用户21366100357220 小时前
VueRouter进阶-动态路由与嵌套路由梯度不陡20 小时前
Signal #17:Agent 开始进入组织系统胡萝卜术20 小时前
从暴力到Z字形消元:力扣240「搜索二维矩阵II」的降维打击之路云浪21 小时前
前端二进制数组完全指南:ArrayBuffer、TypedArray、DataView 一次讲透铁皮饭盒1 天前
26年bunjs, elysia+pg一把梭, redis都省了kyriewen1 天前
别再对着 TypeScript 报错发呆了:我把 10 个最常见的红色波浪线翻译成了人话free351 天前
从 0 实现一个 Tiny JavaScript VM:项目架构拆解