以下是具体的代码实现:
const handleExportModal = async () => {
const response = await getExportApi({
a: xxxxxxx,
b: xxxxxx,
});
const url = window.URL.createObjectURL(response.data);
const link = document.createElement("a");
link.href = url;
link.setAttribute("download", `我是文件名_${new Date().getTime()}.xlsx`); // 文件名
document.body.appendChild(link);
link.click();
link.remove();
window.URL.revokeObjectURL(url);
};