微信小程序环境识别
const accountInfo = wx.getAccountInfoSync();
accountInfo.miniProgram.envVersion会有三个值:
- develop:开发版(正常开发工具,测试时)
- trial:体验版
- release:正式版
onLaunch() {
const accountInfo = wx.getAccountInfoSync();
switch (accountInfo.miniProgram.envVersion) {
case 'develop':
//dosomething
break;
case 'trial':
//dosomething
break;
case 'release':
//dosomething
break;
default:
//dosomething
break;
}
console.log(accountInfo)
}
本文是原创文章,采用CC BY-NC-SA 4.0协议,完整转载请注明来自耕田日记
评论