fix: 版本号问题修复。
This commit is contained in:
@@ -36,7 +36,23 @@ import { computed } from 'vue'
|
||||
import config from '@/config.js'
|
||||
|
||||
const url = config.appInfo.site_url
|
||||
const version = config.appInfo.version
|
||||
// 动态获取版本号
|
||||
// - 微信小程序:优先读取小程序后台提交发布时填写的版本号,为空时回退到 config
|
||||
// 注:在微信开发者工具中调用时 miniProgram.version 通常为空字符串,
|
||||
// 只有体验版/正式版发布后才有真实值
|
||||
// - 其他端(H5/APP):使用 config 中的版本号
|
||||
let version = config.appInfo.version
|
||||
// #ifdef MP-WEIXIN
|
||||
try {
|
||||
const accountInfo = uni.getAccountInfoSync()
|
||||
const mpVersion = accountInfo && accountInfo.miniProgram && accountInfo.miniProgram.version
|
||||
if (mpVersion) {
|
||||
version = mpVersion
|
||||
}
|
||||
} catch (e) {
|
||||
console.warn('getAccountInfoSync 调用失败,使用 config 中的版本号:', e)
|
||||
}
|
||||
// #endif
|
||||
// 动态显示当前年份
|
||||
const currentYear = new Date().getFullYear()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user