downloadUrl(url) {
url = this.http.ip + url
console.log("url",url);
uni.downloadFile({
url: url,
success: res => {
uni.hideLoading();
uni.saveFile({
tempFilePath: res.tempFilePath, //临时路径
success: res => {
uni.showModal({
title: '提示',
content: '清单已导出:' + url.substring(url.lastIndexOf('/')),
cancelText: '我知道了',
confirmText: '打开文件',
success: r => {
if (r.confirm) {
uni.openDocument({
filePath: res.savedFilePath,
showMenu: true,
success: res => {}
});
}
}
});
}
});
},
fail: err => {
uni.showModal({ content: '导出文件失败', showCancel: false });
}
});
}
app移动端下载的代码片段
猜你喜欢
转载自blog.csdn.net/qq_52421092/article/details/132042199
今日推荐
周排行