Table of contents
The first way is to get the App version number
App version number
// 获取当前app的版本
const systemInfo = uni.getSystemInfoSync();
// 应用程序版本号
// 条件编译,只在APP渲染
// #ifdef APP
this.version_number = systemInfo.appWgtVersion;
// #endif
App’s H5 version number
// 获取当前app的版本
const systemInfo = uni.getSystemInfoSync();
// 应用程序版本号
// 条件编译,只在H5渲染
// #ifdef H5
this.version_number = systemInfo.appVersion;
console.log(systemInfo.appVersion,'版本号');
// #endif
The second way to get the App version number
Printing can only be done in mobile phone mode, and cannot be obtained in h5 preview mode!!!
console.log(plus.runtime.version, '版本号')
this.version = plus.runtime.version
The third way to get the App version number
uni.getSystemInfo({
success: function(res) {
console.log(res)
console.log(res.appVersion, 'APP版本号')
}
})
The first method is to obtain the WeChat applet version number
Get the WeChat applet version number
// 条件编辑只在微信小程序显示
// #ifdef MP-WEIXIN
const accountInfo = wx.getAccountInfoSync();
this.version_number = accountInfo.miniProgram.version // 小程序 版本号
console.log(accountInfo.miniProgram.version, '小程序版本号')
// #endif
at last
If you think the article is good, remember to give it a thumbs up, follow it, and add it to your favorites. Please correct me if there are any mistakes. If you need to reprint it, please indicate the source. Thank you! ! !