使用插件downloadjs,官网地址:http://danml.com/使用方法:https://github.com/rndme/downloadvue中使用:var x = new XMLHttpRequest()
x.open("GET", sUrl, true)
x.responseType = 'blob'
var _this = this
x.onload=function(e){
download(x.response, _this.title, mimeType )
}
x.send()sUrl为文件地址,mimeType文件类型,因为我的业务是有多种文件类型,所以在前文加了判断。js文件下载,download.js,解决新窗口打开文件的问题。...