📅  最后修改于: 2022-03-11 14:58:13.103000             🧑  作者: Mango
//Use the download attribute.
var link = document.createElement('a');
link.href = url;
link.download = 'file.pdf';
link.dispatchEvent(new MouseEvent('click'));