export const exportCsv = (title: string, data: any[]) => {
const dataValue = data.map(val => ${Array.isArray(val) ? val.map((valItem: string) => String(valItem)).join(',') : val}\n
);
const blob = new Blob([\uFEFF${dataValue.join('')}
], { type: 'text/csv;charset=gb2312;' });
const a = document.createElement('a');
a.download = ${title}.csv
;// 这里替换为你需要的文件名
a.href = URL.createObjectURL(blob);
a.click();
};
网友评论