Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
hello uni-app x
提交
3a814b62
H
hello uni-app x
项目概览
DCloud
/
hello uni-app x
通知
6048
Star
92
Fork
165
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
19
列表
看板
标记
里程碑
合并请求
1
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
H
hello uni-app x
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
19
Issue
19
列表
看板
标记
里程碑
合并请求
1
合并请求
1
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
3a814b62
编写于
12月 07, 2024
作者:
DCloud-WZF
💬
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(downloadFile): 修复错误方法名
上级
6aa560bb
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
29 addition
and
29 deletion
+29
-29
pages/API/download-file/download-file.uvue
pages/API/download-file/download-file.uvue
+29
-29
未找到文件。
pages/API/download-file/download-file.uvue
浏览文件 @
3a814b62
...
@@ -10,11 +10,11 @@
...
@@ -10,11 +10,11 @@
</view>
</view>
<view v-else style="margin: 10px;">
<view v-else style="margin: 10px;">
<text class="uni-hello-text">点击按钮下载服务端示例图片(下载网络文件到本地临时目录)</text>
<text class="uni-hello-text">点击按钮下载服务端示例图片(下载网络文件到本地临时目录)</text>
<button type="primary" @tap="downloadImage
nal
">下载</button>
<button type="primary" @tap="downloadImage">下载</button>
</view>
</view>
<view style="margin: 10px;">
<view style="margin: 10px;">
<text class="uni-hello-text">下载接口的Content-Disposition中的filename非法值例子</text>
<text class="uni-hello-text">下载接口的Content-Disposition中的filename非法值例子</text>
<button type="primary" @tap="downloadErrorFilename">下载</button>
<button type="primary" @tap="downloadErrorFilename">下载</button>
</view>
</view>
</view>
</view>
</view>
</view>
...
@@ -37,7 +37,7 @@
...
@@ -37,7 +37,7 @@
imageSrc: '',
imageSrc: '',
task: null as DownloadTask | null,
task: null as DownloadTask | null,
//自动化测试例专用
//自动化测试例专用
jest_result: false,
jest_result: false,
jest_callback_triggred: false
jest_callback_triggred: false
}
}
},
},
...
@@ -71,29 +71,29 @@
...
@@ -71,29 +71,29 @@
this.task?.onProgressUpdate((update) => {
this.task?.onProgressUpdate((update) => {
console.log("progress : ", update.progress);
console.log("progress : ", update.progress);
})
})
},
},
downloadErrorFilename(){
downloadErrorFilename(){
uni.downloadFile({
uni.downloadFile({
url:"https://qiniu-web-assets.dcloud.net.cn/uni-app-x/static/file/test9.txt",
url:"https://qiniu-web-assets.dcloud.net.cn/uni-app-x/static/file/test9.txt",
success: (res) => {
success: (res) => {
console.log('downloadFile success, res is', res.tempFilePath)
console.log('downloadFile success, res is', res.tempFilePath)
},
},
fail: (err) => {
fail: (err) => {
console.log('downloadFile fail, err is:', err)
console.log('downloadFile fail, err is:', err)
}
}
})
})
},
},
//自动化测试例专用
//自动化测试例专用
jest_downloadFile() {
jest_downloadFile() {
uni.downloadFile({
uni.downloadFile({
url: "https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/uni-app.png",
url: "https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/uni-app.png",
success: () => {
success: () => {
this.jest_result = true
this.jest_result = true
this.jest_callback_triggred = true
this.jest_callback_triggred = true
},
},
fail: () => {
fail: () => {
this.jest_result = false
this.jest_result = false
this.jest_callback_triggred = true
this.jest_callback_triggred = true
}
}
});
});
},
},
...
@@ -104,11 +104,11 @@
...
@@ -104,11 +104,11 @@
filePath: `${uni.env.CACHE_PATH}/a/b/`,
filePath: `${uni.env.CACHE_PATH}/a/b/`,
success: () => {
success: () => {
this.jest_result = true
this.jest_result = true
this.jest_callback_triggred = true
this.jest_callback_triggred = true
},
},
fail: () => {
fail: () => {
this.jest_result = false
this.jest_result = false
this.jest_callback_triggred = true
this.jest_callback_triggred = true
}
}
});
});
},
},
...
@@ -123,11 +123,11 @@
...
@@ -123,11 +123,11 @@
firstIpv4: false,
firstIpv4: false,
success: () => {
success: () => {
this.jest_cookie_download(true)
this.jest_cookie_download(true)
this.jest_callback_triggred = true
this.jest_callback_triggred = true
},
},
fail: () => {
fail: () => {
this.jest_result = false;
this.jest_result = false;
this.jest_callback_triggred = true
this.jest_callback_triggred = true
},
},
});
});
},
},
...
@@ -142,7 +142,7 @@
...
@@ -142,7 +142,7 @@
firstIpv4: false,
firstIpv4: false,
success: () => {
success: () => {
this.jest_cookie_download(false)
this.jest_cookie_download(false)
this.jest_callback_triggred = true
this.jest_callback_triggred = true
},
},
fail: () => {
fail: () => {
this.jest_result = false;
this.jest_result = false;
...
@@ -169,7 +169,7 @@
...
@@ -169,7 +169,7 @@
this.jest_callback_triggred = true
this.jest_callback_triggred = true
},
},
fail: (err : any) => {
fail: (err : any) => {
this.jest_result = false
this.jest_result = false
this.jest_callback_triggred = true
this.jest_callback_triggred = true
}
}
} as CommonOptions)
} as CommonOptions)
...
@@ -178,12 +178,12 @@
...
@@ -178,12 +178,12 @@
jest_special_characters_download() {
jest_special_characters_download() {
uni.downloadFile({
uni.downloadFile({
url: "https://web-ext-storage.dcloud.net.cn/hello-uni-app-x/1789834995055525889-你好%23你好.png",
url: "https://web-ext-storage.dcloud.net.cn/hello-uni-app-x/1789834995055525889-你好%23你好.png",
success: (res : DownloadFileSuccess) => {
success: (res : DownloadFileSuccess) => {
this.jest_result = true;
this.jest_result = true;
this.jest_callback_triggred = true
this.jest_callback_triggred = true
},
},
fail: () => {
fail: () => {
this.jest_result = false;
this.jest_result = false;
this.jest_callback_triggred = true
this.jest_callback_triggred = true
}
}
});
});
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录