We can use window.location.href = 'url' to download files, or use a tag, but if you download multiple files at a time, this method will not work, you can use the following methods to achieve
// 下载多个模版
downloadBtn () {
const data = [
'url1',
'url2'
]
for (let i = 0; i < data.length; i++) {
const iframe = document.createElement('iframe')
iframe.style.display = 'none'
iframe.style.height = 0
// url自己进行指定
iframe.src = data[i]
document.body.appendChild(iframe)
// 不能马上将iframe进行删除,否者也会出现马上取消的情况
setTimeout(() => {
iframe.remove()
}, 5 * 1000)
}
}