收藏
回答

小程序收藏pdf文件后,安卓手机在收藏夹无法识别文件格式?ios正常

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',
        })
      },
    })
  },
回答关注问题邀请回答
收藏

2 个回答

  • 社区技术运营专员--阳光
    社区技术运营专员--阳光
    09-26

    不是预期表现 我们排查下

    09-26
    有用
    回复
  • 智能回答 智能回答 本次回答由AI生成
    09-22
    有用
    回复
登录 后发表内容