ui上传组件el(2)

private objAddItem(tempArr: any[], file: any) { const tempObj = { uid: file.uid, // uid用于辨别文件 originalName: file.name, // 列表显示的文件名 progress: 0, // 进度条 code: 200, // 上传状态 }; tempArr.push(tempObj); this.$emit('changeFileList', tempArr); }

上传的文件下载封装

private downloadFileFun(url: any) { const iframe: any = document.createElement('iframe') as HTMLIFrameElement; iframe.style.display = 'none'; // 防止影响页面 iframe.style.height = 0; // 防止影响页面 iframe.src = url; document.body.appendChild(iframe); // 这一行必须,iframe挂在到dom树上才会发请求 // 5分钟之后删除(onload方法对于下载链接不起作用,就先抠脚一下吧) setTimeout(() => { iframe.remove(); }, 5 * 60 * 1000); }

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/0bfeb0f5c2190405b89042ce995af71d.html