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(() => {});
},