Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Hooke
/
data-table
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Network
Create a new issue
Commits
Issue Boards
Authored by
hookehuyr
2024-07-29 14:24:13 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
658639cfc98f57f18eb57de26d7a1ed2f00a6fe0
658639cf
1 parent
2b936164
文件下载优化微信浏览器判断不同系统处理
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
3 deletions
src/components/FileUploaderField/index.vue
src/components/FileUploaderField/index.vue
View file @
658639c
<!--
* @Date: 2022-08-31 16:16:49
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2024-07-2
7 19:30:34
* @LastEditTime: 2024-07-2
9 14:10:48
* @FilePath: /data-table/src/components/FileUploaderField/index.vue
* @Description: 文件上传控件
-->
...
...
@@ -69,6 +69,7 @@
>
{{ item.name }}
</a>
<a class="app-download-btn" id="BtnClick" href="javascript:;" style="display: none;"> 点此继续访问 </a>
</div>
</div>
...
...
@@ -117,8 +118,20 @@ onMounted(() => {
const downloadFile = (item) => {
if (wxInfo().isWeiXin) {
// 在微信内置浏览器中,直接跳转到手机自带浏览器中下载文件
window.location.href = item.url;
// 安卓浏览器
if (wxInfo().isAndroid) {
var iframe = document.createElement("iframe");
iframe.style.display = "none";
iframe.src = item.url;
document.body.appendChild(iframe);
iframe.click();
}
// IOS浏览器
else if (wxInfo().isiOS) {
var entityDom = document.getElementById('BtnClick');
entityDom.href = item.url;
entityDom.click();
}
} else {
// 不在微信内置浏览器中,直接打开下载链接
fileLinkToStreamDownload(item.url, item.name, item.name.split('.').pop());
...
...
Please
register
or
login
to post a comment