vue 根据后端接口导出excel数据
·
1.导出按钮
<template #operate="{ scope }">
<el-button @click="exportExcel(scope.row.id)">导出</el-button>
</template>
2.导出
// 点击导出
exportExcel(id) {
this.$confirm("此操作将导出excel文件, 是否继续?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(() => {
const link = document.createElement("a");
link.target = "_blank";
link.href =
window.location.origin +
"/api/bill/excel?id=" +
id;
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
})
.catch(() => {});
},
DAMO开发者矩阵,由阿里巴巴达摩院和中国互联网协会联合发起,致力于探讨最前沿的技术趋势与应用成果,搭建高质量的交流与分享平台,推动技术创新与产业应用链接,围绕“人工智能与新型计算”构建开放共享的开发者生态。
更多推荐



所有评论(0)