<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
相关推荐
chilavert3181 小时前
技术演进中的开发沉思-191 JavaScript: 发展历程(上篇)武昌库里写JAVA2 小时前
微擎服务器配置要求,微擎云主机多少钱一年?dy17172 小时前
el-table表头上下显示内容亮子AI3 小时前
给你的应用加上Google账号登录努力往上爬de蜗牛3 小时前
react native 实现选择图片或者拍照上传(多张)谢尔登3 小时前
【React】React组件的渲染过程分为哪几个阶段?q***72564 小时前
Spring Boot + Vue 全栈开发实战指南lcc1874 小时前
Vue Vue与VueComponent的关系无敌最俊朗@4 小时前
Vue 3 概况游九尘4 小时前
Element UI 2.x 校验数组每个对象中的name不能为空