<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
相关推荐
meilindehuzi_a8 小时前
从零理解并实现 RAG:用 LangChain.js 构建语义检索问答系统鱼樱前端9 小时前
别再自己拼凑了!这款 Vue 3.5+ 严肃产品级组件库,把 AI 对话、工作流和复杂数据全包了!Listen·Rain10 小时前
Vue3:setup详解kyriewen11 小时前
面试官让我优化一个卡死的表格,我打开 Claude 五秒重写,他放下咖啡问我要不要来当组长小粉粉hhh12 小时前
React(二)——dom、组件间通信、useEffect索西引擎13 小时前
【React】key 属性:协调算法中的元素标识机制与最佳实践只会cv的前端攻城狮14 小时前
动态组件架构设计:从配置到事件驱动全链路解析万敏14 小时前
Vue3 全栈实战第二周:Pinia + Vite + Router + axios 完整记录OpenTiny社区14 小时前
TinyEngine 2.11版本发布:AI 进一步融入画布,Vue 工程可一键转DSL小雪_Snow14 小时前
JavaScript 中的三种常用事件