- <a d ownload class="down" title="">
-
function download(src,name) {
// 创建隐藏的可下载链接
var eleLink = document.createElement('a');
eleLink.href = src;
eleLink.download = name;
eleLink.style.display = 'none';
eleLink.href = src;
document.body.appendChild(eleLink);
eleLink.click();
document.body.removeChild(eleLink);
} - //js下载文件
-
case 'show':
var urls = data.fileurl;var three = urls.split(".");
var last = '.' + three[three.length - 1];
last = last.toLowerCase();
if (last == ".pdf") {
common.CreateAddForm('查看', urls, {
'100%',
height: '100%'
});
} else {
download(urls, data.filename);
}
break;