第一種獲取App版本號(hào)
App版本號(hào)
// 獲取當(dāng)前app的版本
const systemInfo = uni.getSystemInfoSync();
// 應(yīng)用程序版本號(hào)
// 條件編譯,只在APP渲染
// #ifdef APP
this.version_number = systemInfo.appWgtVersion;
// #endif
App的H5版本號(hào)
// 獲取當(dāng)前app的版本
const systemInfo = uni.getSystemInfoSync();
// 應(yīng)用程序版本號(hào)
// 條件編譯,只在H5渲染
// #ifdef H5
this.version_number = systemInfo.appVersion;
console.log(systemInfo.appVersion,'版本號(hào)');
// #endif
第二種獲取App版本號(hào)
只能在手機(jī)模式下才可以打印 , h5 預(yù)覽模式獲取不到的 !!!文章來源:http://www.zghlxwxcb.cn/news/detail-766819.html
console.log(plus.runtime.version, '版本號(hào)')
this.version = plus.runtime.version
第三種獲取App版本號(hào)
uni.getSystemInfo({
success: function(res) {
console.log(res)
console.log(res.appVersion, 'APP版本號(hào)')
}
})
第一種獲取微信小程序版本號(hào)
獲取微信小程序版本號(hào)
// 條件編輯只在微信小程序顯示
// #ifdef MP-WEIXIN
const accountInfo = wx.getAccountInfoSync();
this.version_number = accountInfo.miniProgram.version // 小程序 版本號(hào)
console.log(accountInfo.miniProgram.version, '小程序版本號(hào)')
// #endif
最后
感覺文章好的話記得點(diǎn)個(gè)心心和關(guān)注和收藏,有錯(cuò)的地方麻煩指正一下,如果需要轉(zhuǎn)載,請(qǐng)標(biāo)明出處,多謝?。。?span toymoban-style="hidden">文章來源地址http://www.zghlxwxcb.cn/news/detail-766819.html
到了這里,關(guān)于uniapp獲取app版本號(hào)、h5版本號(hào)、微信小程序版本號(hào)的方法的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!