下载文件

downLoad: downLoadUrl => {
let a = document.createElement('a')
if (a.download) {
a.href = downLoadUrl
if (document.createEvent) {
var evObj = document.createEvent('MouseEvents')
evObj.initEvent(
'click',
true,
true,
window,
1,
12,
345,
7,
220,
false,
false,
true,
false,
0,
null
)
a.dispatchEvent(evObj)
} else if (document.createEventObject) {
a.fireEvent('onmousemove')
}
} else {
window.open(downLoadUrl, '_blank')
}
},
posted @ 2018-08-23 09:54  孤魂1715  阅读(76)  评论(0编辑  收藏  举报