API: wx.addFileToFavorites
collectFile() {
const { fileName, fileUrl } = this.data
wx.showLoading({
title: '正在收藏文件...',
})
wx.downloadFile({
url: fileUrl,
success(res) {
// 下载完成后收藏
wx.addFileToFavorites({
filePath: res.tempFilePath,
fileName,
success() {
wx.showToast({
title: '收藏成功',
icon: 'success',
})
},
complete() {
wx.hideLoading()
},
})
},
fail(err) {
wx.hideLoading()
console.error('收藏文件失败:', err)
wx.showToast({
title: '收藏文件失败',
icon: 'error',
})
},
})
},
不是预期表现 我们排查下