第一步
找到你的txt文件,重命名為json文件
第二步
上傳到雲存儲中,獲取File ID
第三步
編寫js代碼
onShow:function(){ wx.cloud.downloadFile({ fileID: 'cloud://xsl1-grzy6.7873-xsl1-grzy6-1259288832/管.json' }).then(res => { console.log(res.tempFilePath) let fs=wx.getFileSystemManager() let result = fs.readFileSync(res.tempFilePath,"utf-8") this.setData({ allcontent: result }) }) }
完成
相關文檔:https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.readFile.html