无语了,怎么读都读不到。 网上也找不到正确的使用示例。 还有 一些文章就是在瞎写,居然还有人点赞,服气。 最后终于找到某些大腿评论提供的方法了。 let version = wx.getAccountInfoSync().miniProgram.envVersion if( version == 'develop') echo '开发版'; if( version == 'trial') echo '体验版'; if( version == 'release') echo '正式版'; https://developers.weixin.qq.com/miniprogram/dev/api/open-api/account-info/wx.getAccountInfoSync.html
为何fileManager.accessSync获取文件失败?const fileManager = wx.getFileSystemManager(); try { fileManager.accessSync('/env.txt');//这个文件放在项目根目录下 that.globalData.ENV = ENVS.DEV; } catch (e) { console.log(e) that.globalData.ENV = ENVS.PROD; } 报错 Error: accessSync:fail no such file or directory, access "/env.txt" at accessSync (VM663 WAService.js:1) at Object.e.<computed> [as accessSync] (VM663 WAService.js:1) at pe.onLaunch (app.js? [sm]:32) at pe.<anonymous> (VM663 WAService.js:1) at VM663 WAService.js:1 at new pe (VM663 WAService.js:1) at Function.<anonymous> (VM663 WAService.js:1) at VM663 WAService.js:1 at app.js? [sm]:12 at require (VM663 WAService.js:1)
2020-06-24