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