Commit f2e1f75d by 李伟康

增加注释

1 parent 30e0d4fe
...@@ -150,37 +150,46 @@ export default { ...@@ -150,37 +150,46 @@ export default {
} }
}, },
mounted () { mounted () {
const userAgent = navigator.userAgent, this.checkOpenLaunch()
wechat_version = userAgent.match(/MicroMessenger\/([\d\.]+)/i)[1]
try {
let [w_a, w_b, w_c] = wechat_version.split('.')
if (!w_c) c = 0
if (w_a < 7) throw false
if (w_a == 7 && w_b == 0 && w_c < 12) throw false
if (userAgent.includes('iPhone') || userAgent.includes('iPad')) {
let [phone_version] = userAgent.match(/iPhone OS .*?(?= )/)
if (phone_version) {
let [a, b] = phone_version.split(' ').at(-1).split('_')
if (!b) b = 0
if (a < 10) throw false
if (a == 10 && b < 3) throw false
if (a == 15 && w_a == 8 && w_b == 0 && w_c < 8) throw false
}
}
if (userAgent.includes('Android')) {
let [phone_version] = userAgent.match(/Android.*?(?=;)/)
if (phone_version) {
let [a] = phone_version.split(' ').at(-1).split('.')
if (a < 5) throw false
}
}
} catch (error) {
this.supportOpenLaunch = error
}
this.iSMiniprogram = window.__wxjs_environment === 'miniprogram' this.iSMiniprogram = window.__wxjs_environment === 'miniprogram'
}, },
methods: { methods: {
checkOpenLaunch () {
/**
* 微信版本要求为:7.0.12及以上
* 系统版本要求为:iOS 10.3及以上、Android 5.0及以上
*/
const userAgent = navigator.userAgent,
wechat_version = userAgent.match(/MicroMessenger\/([\d\.]+)/i)[1]
try {
let [w_a, w_b, w_c] = wechat_version.split('.')
if (!w_c) c = 0
if (w_a < 7) throw false
if (w_a == 7 && w_b == 0 && w_c < 12) throw false
if (userAgent.includes('iPhone') || userAgent.includes('iPad')) {
let phone_version = userAgent.match(/iPhone OS ([\d\_]+)/i)[1]
if (phone_version) {
let [a, b] = phone_version.split('_')
if (!b) b = 0
if (a < 10) throw false
if (a == 10 && b < 3) throw false
/**
* 👇 iOS15底层 WebKit 接口发生变更,微信版本8.0.8以下(不包括8.0.8)无法使用开放标签,可引导用户升级最新版本微信
*/
if (a == 15 && w_a == 8 && w_b == 0 && w_c < 8) throw false
}
}
if (userAgent.includes('Android')) {
let phone_version = userAgent.match(/Android ([\d\.]+)/i)[1]
if (phone_version) {
let [a] = phone_version.split('.')
if (a < 5) throw false
}
}
} catch (error) {
this.supportOpenLaunch = error
}
},
errorToast () { errorToast () {
this.showToast('当前系统或微信版本不支持该功能,请升级后再试。') this.showToast('当前系统或微信版本不支持该功能,请升级后再试。')
}, },
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!