收藏
回答

wx.downloadFile显示filePath为Undefined,可是打印出来是有的啊?

 wx.downloadFile{
                filePath: wx.env.USER_DATA_PATH + '/' + 'temp.pdf',
                url: url,
                header:{
                    Authorization:wx.getStorageSync('token')
                },
                success:(res)=>{
                    if(res.statusCode == 200) {
                            wx.openDocument({
                                filePath: res.tempFilePath,
                                showMenu:true,
                                fileType:'pdf',
                                success(data) {
                            },
                            failconsole.error,
                        })
                    }
                },
                fail:(error)=>{
                    console.log(error);
                    setTimeout(()=>{
                        wx.showToast({
                            icon:'error',
                            title'错误'
                        })
                    },300)
                },
                complete:()=>{
                }
            })
        },

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

1 个回答

  • Mr.Zhao
    Mr.Zhao
    2023-05-17

    打印res.tempFilePath

    2023-05-17
    有用 1
    回复 1
    • *~*
      *~*
      2023-05-17
      感谢,我以为是wx.downloadFile有问题,你一提示我才发现是wx.openDocument的问题
      2023-05-17
      回复
登录 后发表内容