<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
相关推荐
程序员黄同学42 分钟前
请谈谈 Vue 中的 key 属性的重要性,如何确保列表项的唯一标识?繁依Fanyi1 小时前
巧妙实现右键菜单功能,提升用户操作体验前端御书房1 小时前
前端防重复请求终极方案:从Loading地狱到精准拦截的架构升级web182854825121 小时前
nginx 部署前端vue项目程序员黄同学1 小时前
解释 Vue 中的虚拟 DOM,如何通过 Diff 算法最小化真实 DOM 更新次数?果粒chenl1 小时前
css+js提问memorycx1 小时前
Vue02hmywillstronger2 小时前
【Excel】【VBA】根据内容调整打印区域道不尽世间的沧桑5 小时前
第17篇:网络请求与Axios集成oh,huoyuyan7 小时前
火语言RPA--Excel删除内容