调用回调函数获取值并在中呈现
onDownload: (buildHead, buildBody, columns, data) => {
if (this.state.isexceldownload) {
this.callbackMethod((d) => {
console.log(d);
let val = `${buildHead(columns)}${buildBody(d)}`.trim();
console.log(val)
return val
});
}
}
单击后,它将下载第一个单元格上有未定义的CSV文件。
val中的数据集是:
"Col-1","Col-2","Col-3","Col-4","Col-5","Col-6","Col-7"
"007","Car","","US","","Matte Black","Available"
"009","Bike","","UK","","Blue","Available"
我想知道,我哪里错了。提前感谢
当文件下载为CSV而不是时,操作任何想要更改的数据后
let val = `${buildHead(columns)}${buildBody(d)}`.trim();
console.log(val)
return val
尝试返回此
return "uFEFF" + buildHead(columns) + buildBody(data);