获取小程序的appid,获取小程序的当前版本号,直接调用wx.getAccountInfoSync(),直接上代码:
let accountInfo = wx.getAccountInfoSync();
let appid = accountInfo.miniProgram.appId; // "wxfb6368d158c85cb7"小程序appid
let envVersion = accountInfo.miniProgram.envVersion; // "develop"开发版
let version = accountInfo.miniProgram.version; // 1.0.0 小程序版本号