wx.openDocument打开txt文件,在安卓下成功打开,在ios下失败?
发布于 5 年前 作者 fangcui 7021 次浏览 来自 官方Issues
const FileSystemManager = wx.getFileSystemManager();
    var filePath = `${wx.env.USER_DATA_PATH}/test.txt`;
    console.log('filePath:', filePath);
    FileSystemManager.writeFileSync(filePath, ’hello world~~‘, 'utf8');
    const temp = FileSystemManager.readFileSync(filePath, 'utf8');
    console.log("文件内容:", temp);
    wx.openDocument({
      filePath: filePath,
      success: function(res) {
        console.log("打开文档成功", res);
        
      },
      fail: function(res) {
        console.log("打开文档失败", res);
        
      }
    })
2 回复

具体是什么问题?麻烦提供出现问题的具体机型、微信版本号、系统版本号,以及能复现问题的代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html

所谓 “失败” 太过粗略了,不是一个合格的问题,帖出报错吧。

回到顶部