本来是点击后js加上a标签的href属性。但是需要一进入页面就直接链接完整下载地址
<a name="file" download="filename" href="filepath">filename</a>
//filename -> a.docx
//filepath -> /uploadFile/20190802/201908020955486975.docx
**a标签链接的图片会直接打开,覆盖页面,需要加上 target **
<a name="file" download="filename" href="filepath" target="_blank">filename</a>
//filename -> a.docx
//filepath -> /uploadFile/20190802/201908020955486975.docx
<script>
$(document).ready(function () {
//给file前加上当前主机网址
$.each($("a[name='file']"), function (k, v) {
$(v).attr("href", 'http://' + window.location.host + $(v).attr("href"));
});
})
</script>