【动态创建a链接执行跳转】

1 export const createLinkToClick1 = (link, linkType) => {
2   let aLink = document.createElement('a');
3   aLink.href = link;
4   aLink.target = linkType || '_blank';
5   aLink.style.display = 'none';
6   document.body.appendChild('aLink');
7   aLink.click();
8   document.body.removeChild('aLink')
9 }

 

posted @ 2020-11-13 10:10  行屰  阅读(353)  评论(0编辑  收藏  举报