var download = require('../assets/download.js')
function down(v){
if(v.indexOf('.txt')!==-1){
var x=new XMLHttpRequest();
x.open("GET", v, true);
x.responseType = 'blob';
x.onload=function(e){download(x.response, 'xxx.txt', "text/plain" ); }
x.send();
}else{
window.open(v)
}
}
使用js下载txt文件
最新推荐文章于 2024-08-26 14:54:22 发布