let a = document.createElement('a');
a.setAttribute('href', 'https://img1.baidu.com/it/u=1342639626,1157163052&fm=26&fmt=auto&gp=0.jpg');
a.setAttribute('download', '文件名字');
var event = new MouseEvent('click');
a.dispatchEvent(event);