You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
csvExport: function(jsonData){constreplacer=(key,value)=>(value===null ? "" : value);constheader=Object.keys(jsonData[0]);varcsv=jsonData.map(row=>header.map(fieldName=>JSON.stringify(row[fieldName],replacer)).join(","));csv.unshift(header.join(","));csv=csv.join("\r\n");csv="data:text/csv;charset=utf-8,\uFEFF"+csv;console.log(csv);constlink=document.createElement("a");link.href=encodeURI(csv);link.download=`filename.csv`;document.body.appendChild(link);// Required for FFlink.click();// This will download the data file named 'my_data.csv'.document.body.removeChild(link);// Required for FF}
The text was updated successfully, but these errors were encountered:
在页面中如何将table中的json数据导出为csv文件呢?下面一个方法即可搞定:
The text was updated successfully, but these errors were encountered: