收藏
回答

wx.downloadFile指定路径下载的话,安卓系统正常,IOS系统失败?

onTextTap(event){
        var posturl = this.comp('attachmentImageData').getValue('previewImageUrl');
        console.log(posturl);
        var row = this.comp('restData').getCurrentRow();
        var currenttype = this.comp('restData').getValue('fwjlx');
        var zlname = this.comp('restData').getValue('fziliaomc');
        console.log(zlname + currenttype);
        wx.downloadFile({
            url:posturl,
            filePath: wx.env.USER_DATA_PATH + zlname + currenttype,
            header: {
        'content-type': 'application/json'
          }, 
          fail: function (msg) {
            console.log('失败')
          },
            success:function(res){
              var resPath = res.filePath;                                       
              console.log(res.filePath);
                        wx.openDocument({
                          filePath: resPath,
                            success:function(res){
                                console.log('打开文档成功')
                            },
                            error: function(msg) {
                                console.log(msg)
                            }
                        })
                    }



        })

  }

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

2 个回答

登录 后发表内容
问题标签