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-27 16:15:11 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
15ced18e95d8897d9ca05f6a96c1a485c3535fdb
15ced18e
1 parent
80cffb92
上传组件点击查看现有文件时操作逻辑优化
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
2 deletions
src/components/FileUploaderField/index.vue
src/components/FileUploaderField/index.vue
View file @
15ced18
<!--
* @Date: 2022-08-31 16:16:49
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2024-07-27
08:22:39
* @LastEditTime: 2024-07-27
13:07:02
* @FilePath: /data-table/src/components/FileUploaderField/index.vue
* @Description: 文件上传控件
-->
...
...
@@ -54,13 +54,20 @@
<van-divider />
</div>
<div v-else style="padding: 1rem;">
<a
<
!-- <
a
v-for="(item, index) in default_file" :key="index"
:href="item.url"
:download="item.name"
style="color: #000; font-size: 0.9rem; text-decoration: underline; margin-right: 0.5rem;"
>
{{ item.name }}
</a> -->
<a
@click="downloadFile(item)"
v-for="(item, index) in default_file" :key="index"
style="color: #000; font-size: 0.9rem; text-decoration: underline; margin-right: 0.5rem; cursor:pointer;"
>
{{ item.name }}
</a>
</div>
</div>
...
...
@@ -87,6 +94,7 @@ import BMF from "browser-md5-file";
import { useRoute } from "vue-router";
import axios from "axios";
import { getEtag } from "@/utils/qetag.js"; // 生成hash值
import { wxInfo } from "@/utils/tools";
const $route = useRoute();
const props = defineProps({
...
...
@@ -107,6 +115,16 @@ onMounted(() => {
}
})
const downloadFile = (item) => {
if (wxInfo().isWeiXin) {
// 在微信内置浏览器中,直接跳转到手机自带浏览器中下载文件
window.location.href = item.url;
} else {
// 不在微信内置浏览器中,直接打开下载链接
window.open(item.url, '_blank');
}
}
// 文件类型中文页面显示
const type_text = computed(() => {
return props.item.component_props.file_type;
...
...
Please
register
or
login
to post a comment