写个按钮
首先导出是非常容易的,比起导入的话,导出只有一句话,
先给个按钮
<template slot="menuLeft">
<el-button size="mini" type="success" icon="el-icon-upload2" plain @click="exportExcel()">导出</el-button>
</template>
点击事件
给这个按钮绑定点击事件
exportExcel(){
// this.projectId,this.startTime,this.endTime
window.open(`/api/project-manager/projectReport/exportGeneralTable?projectId=${this.projectId}&startTime=${this.startTime}&endTime=${this.endTime}`)
},
这个open(‘里面就是后台告诉你的导出的地址了’),
后面我写的是携带的参数,后台需要根据判断我传的参数的值有没有,在给我下载excel
到这里就结束了,如果有要知道导入的可以看我的另一篇博客
关于element导入的博客