收藏
回答

安卓调openDocument报document viewer already starting?

安卓某款手机,vivo x23执行下边这个代码,报上图这样的错误?

 openFile = (url:string, name:string) => {
    const manage = Taro.getFileSystemManager()
    Taro.downloadFile({
      url, // 可以是后台返回的地址。这里写的是死的
      success: function (res{
          let savePath = Taro.env.USER_DATA_PATH + '/' + name
          if (res.statusCode == 200) {
            manage.saveFile({
              tempFilePath: res.tempFilePath,
              filePath: savePath,
              success:function(res2){
                console.log('savedFilePath = ', (res2 as any).savedFilePath)
                Taro.openDocument({
                  filePath: (res2 as any).savedFilePath,
                  success: function (res3{
                      console.log('打开文档成功', res3)
                      Taro.hideLoading()
                  },
                  fail: (e) => {
                      console.log(e);
                      Taro.hideLoading()
                  }
              })
              }
            })
          }
      }
  })
  }
回答关注问题邀请回答
收藏

1 个回答

登录 后发表内容