<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
相关推荐
下北沢美食家12 小时前
Express框架入门毕设源码-钟学长13 小时前
【开题答辩全过程】以 基于Vue的租房App为例,包含答辩的问题和答案旭日跑马踏云飞14 小时前
【Nginx】相关优化城数派14 小时前
2005-2025年我国逐日露点温度栅格数据webkubor14 小时前
2026 年 把网页交互的主控权拿回前端手中 🚀Lee川14 小时前
Promise:驾驭 JavaScript 异步编程的艺术Desirediscipline14 小时前
#include<limits>#include <string>#include <sstream>#include <iomanip>SuperEugene15 小时前
手把手写几种常用工具函数:深拷贝、去重、扁平化wuhen_n16 小时前
副作用的概念与effect基础:Vue3响应式系统的核心