async ExportWord(array) {
for (let i = 0; i < array.length; i++) {
const element = array[i];
let url = await this.getExportWord(element.id);
await this.getdownlink(url);
}
},
getExportWord(code) {
return new Promise(resolve => {
API.wordfuwu({ id: code }).then(function (res) {
resolve(res);
})
});
},
getdownlink(code) {
return new Promise(resolve => {
// 创建a标签
const link = document.createElement('a')
link.setAttribute('download', '');
// href链接
link.setAttribute('href', code)
// 自执行点击事件
link.click()
setTimeout(() => {
document.body.removeChild(link)
}, 1000 * 60);
resolve(true);
});
},
vue 批量下载word 文件 循环调用接口 同步
最新推荐文章于 2024-05-20 12:00:42 发布