使用wx.downloadFile下载文件得到的tempFile的后缀是bin,为什么?

您所在的位置:网站首页 小程序的格式 使用wx.downloadFile下载文件得到的tempFile的后缀是bin,为什么?

使用wx.downloadFile下载文件得到的tempFile的后缀是bin,为什么?

2024-04-25 02:24| 来源: 网络整理| 查看: 265

wx.downloadFile({

        url: e.currentTarget.dataset.localfilename,      //要预览的文件的地址

        header: {

          'Content-Type': 'application/xlsx',

        },

        success: function (res) {                           

          console.log(res, 'res'); // 这个返回的地址后缀就是bin

          if (res.statusCode === 200) {       

            var Path = res.tempFilePath                     //返回的文件临时地址,用于后面打开本地预览所用

            wx.openDocument({

              filePath: Path,                               //要打开的文件路径

              success: function (res) {

                console.log('打开PDF成功');

              }

            })

          }

        },

        fail: function (res) {

          console.log(res);                                  //失败

        }

      })

返回结果如下



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3