<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
相关推荐
我叫黑大帅1 小时前
为什么需要 @types/react?解决“无法找到模块 react 的声明文件”报错之歆1 小时前
DAY_21JavaScript 深度解析:数组(Array)与函数(Function)(一)爱上好庆祝3 小时前
学习js的第七天(wed APIs的开始)ooseabiscuit4 小时前
Laravel6.x核心优化与特性全解析哆啦A梦15884 小时前
20, Springboot3+vue3实现前台轮播图和详情页的设计gogoing4 小时前
ESLint 配置字段说明Lkstar4 小时前
面试官让我手写 Promise.all / Promise.race / Promise.allSettled,我直接水灵灵地写出来了gogoing4 小时前
webpack 的性能优化gogoing4 小时前
Node.js 模块查找策略(require 完整流程)gogoing5 小时前
await fetch() 的两阶段设计