收藏
回答

wx.openDocument打开txt文件,在安卓下成功打开,在ios下失败?

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);
        
      }
    })


最后一次编辑于  08-17
回答关注问题邀请回答
收藏

2 个回答

问题标签