problem description
now I need to export the displayed table data to excel, but I have encountered a problem. I have a total of 11 pieces of data, paged, showing 10 pieces of data per page, but there are only 10 pieces of data after exporting to excel, and the data has not been exported, and why it has been repeated three times. I don"t know why. Please take a look at what the problem is.
the environmental background of the problems and what methods you have tried
I found a way on the Internet to enlarge the number of data bars per page before export, then export them, and then change the number of data bars per page back, but it didn"t work. Attach a link to this method https://blog.csdn.net/oStormy.. I don"t know how you solved it
.related codes
/ / Please paste the code text below (do not replace the code with pictures)
first click on the event
< el-button type= "primary" @ click= "fileSaver ()" > {{$t ("public.fileSaver")}} < / el-button >
here is the method
/ to export table data as excel /
fileSaver(){
this.$nextTick(function () {
let wb = XLSX.utils.table_to_book(document.querySelector(".tb-edit"));
let wbout = XLSX.write(wb, { bookType: "xlsx", bookSST: true, type: "array" });
try {
FileSaver.saveAs(new Blob([wbout], { type: "application/octet-stream" }), ".xlsx")
} catch (e) {
if (typeof console !== "undefined") console.log(e, wbout)
}
return wbout;
});
},
then attach a screenshot of the question:
first table data (a total of 11 pieces of data, and one page):
excel:
Please take a look at it