提交 4a002e34 编写于 作者: taohebin@dcloud.io's avatar taohebin@dcloud.io

update: pages/API/download-file/download-file.uvue

上级 a3814d67
...@@ -12,6 +12,10 @@ ...@@ -12,6 +12,10 @@
<text class="uni-hello-text">点击按钮下载服务端示例图片(下载网络文件到本地临时目录)</text> <text class="uni-hello-text">点击按钮下载服务端示例图片(下载网络文件到本地临时目录)</text>
<button type="primary" @tap="downloadImage">下载</button> <button type="primary" @tap="downloadImage">下载</button>
</view> </view>
<view v-else style="margin: 10px;">
<text class="uni-hello-text">下载接口的Content-Disposition中的filename非法值例子</text>
<button type="primary" @tap="downloadErrorFilename">下载</button>
</view>
</view> </view>
</view> </view>
<!-- #ifdef APP --> <!-- #ifdef APP -->
...@@ -67,6 +71,17 @@ ...@@ -67,6 +71,17 @@
console.log("progress : ", update.progress); console.log("progress : ", update.progress);
}) })
}, },
downloadErrorFilename(){
uni.downloadFile({
url:"https://qiniu-web-assets.dcloud.net.cn/uni-app-x/static/file/test9.txt",
success: (res) => {
console.log('downloadFile success, res is', res.tempFilePath)
},
fail: (err) => {
console.log('downloadFile fail, err is:', err)
}
})
},
//自动化测试例专用 //自动化测试例专用
jest_downloadFile() { jest_downloadFile() {
uni.downloadFile({ uni.downloadFile({
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册