<el-button @click="exportExcel" >
<i style="display: inline-block;">
<img src="@/assets/img/export.png" alt>
</i> 导出
</el-button>
==============》
methods: {
exportExcel () {
console.log(111)
if (this.tableData.length) {
this.exportLoading = true
const params = {
title: ['序号', '所属一级分区', '所属二级分区','时间(月)','供水量','环比上月'],
key: ['category1', 'category2', 'category3','category4','category5'],
data: this.tableData,
autoWidth: true,
filename: '供水量统计'
}
excel.export_array_to_excel(params)
this.exportLoading = false
} else {
this.$Message.info('表格数据不能为空!')
}
}
},