收藏
回答

安卓手机微信小程序调用 wx.addFileToFavorites收藏pdf后无打开,ios就可以

框架类型 问题类型 API/组件名称 终端类型 微信版本 基础库版本
小程序 Bug wx.addFileToFavorites 工具 8.0.56 18.3.1

uni.downloadFile({

url: reportObj.value.reportUrl,

success: function (res) {

if (res.statusCode === 200) {

let filePath = res.tempFilePath

console.log('下载成功', filePath, reportObj.value.title)

// #ifdef MP-WEIXIN

// 调用微信收藏文件接口

wx.addFileToFavorites({

filePath: filePath,

fileName: reportObj.value.title + '.pdf',

})

.then(() => {

uni.hideLoading()

setTimeout(() => {

uni.showToast({

title: '已收藏到微信',

})

}, 1000)

})

.catch((err) => {

uni.showToast({

title: '收藏失败',

})

})

// #endif

}

},


回答关注问题邀请回答
收藏

1 个回答

登录 后发表内容