const downloadAddress = (e: any) => {
console.log('🚀 ~ downloadAddress ~ e:', e)
uni.downloadFile({
url: useHost + e,
success: (res) => {
if (res.statusCode == 200) {
uni.showToast({
title: '下载成功,正在打开...',
icon: 'exception',
duration: 850,
})
setTimeout(() => {
console.log('下载成功', res.tempFilePath)
wx.openDocument({
showMenu: true, //打开右上角分享功能
fileType: 'pdf',
filePath: res.tempFilePath,
success: function (res1) {
console.log('打开文档成功', res1)
},
})
}, 1000)
}
},
})
}
uniapp点击按钮下载文件
最新推荐文章于 2024-08-02 17:55:19 发布