关于前端:Vue-下载本地静态资源

下载本地的exe,咱们要把须要下载的动态资源放在static文件夹下

<a href="/static/codebase/WebComponentsKit.exe" download="WebComponentsKit.exe" target="_blank">测试</a>

模仿a标签办法

<el-button @click="download">test</el-button>
downloadClick(row) {
    var a = document.createElement('a')
    a.setAttribute('href', "/static/codebase/WebComponentsKit.exe")
    a.setAttribute('download' ,"WebComponentsKit.exe")
    document.body.appendChild(a)
    a.click()~~~~
}

评论

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

这个站点使用 Akismet 来减少垃圾评论。了解你的评论数据如何被处理