Commit f2e1f75d by 李伟康

增加注释

1 parent 30e0d4fe
...@@ -150,6 +150,15 @@ export default { ...@@ -150,6 +150,15 @@ export default {
} }
}, },
mounted () { mounted () {
this.checkOpenLaunch()
this.iSMiniprogram = window.__wxjs_environment === 'miniprogram'
},
methods: {
checkOpenLaunch () {
/**
* 微信版本要求为:7.0.12及以上
* 系统版本要求为:iOS 10.3及以上、Android 5.0及以上
*/
const userAgent = navigator.userAgent, const userAgent = navigator.userAgent,
wechat_version = userAgent.match(/MicroMessenger\/([\d\.]+)/i)[1] wechat_version = userAgent.match(/MicroMessenger\/([\d\.]+)/i)[1]
try { try {
...@@ -158,29 +167,29 @@ export default { ...@@ -158,29 +167,29 @@ export default {
if (w_a < 7) throw false if (w_a < 7) throw false
if (w_a == 7 && w_b == 0 && w_c < 12) throw false if (w_a == 7 && w_b == 0 && w_c < 12) throw false
if (userAgent.includes('iPhone') || userAgent.includes('iPad')) { if (userAgent.includes('iPhone') || userAgent.includes('iPad')) {
let [phone_version] = userAgent.match(/iPhone OS .*?(?= )/) let phone_version = userAgent.match(/iPhone OS ([\d\_]+)/i)[1]
if (phone_version) { if (phone_version) {
let [a, b] = phone_version.split(' ').at(-1).split('_') let [a, b] = phone_version.split('_')
if (!b) b = 0 if (!b) b = 0
if (a < 10) throw false if (a < 10) throw false
if (a == 10 && b < 3) 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 (a == 15 && w_a == 8 && w_b == 0 && w_c < 8) throw false
} }
} }
if (userAgent.includes('Android')) { if (userAgent.includes('Android')) {
let [phone_version] = userAgent.match(/Android.*?(?=;)/) let phone_version = userAgent.match(/Android ([\d\.]+)/i)[1]
if (phone_version) { if (phone_version) {
let [a] = phone_version.split(' ').at(-1).split('.') let [a] = phone_version.split('.')
if (a < 5) throw false if (a < 5) throw false
} }
} }
} catch (error) { } catch (error) {
this.supportOpenLaunch = error this.supportOpenLaunch = error
} }
this.iSMiniprogram = window.__wxjs_environment === 'miniprogram'
}, },
methods: {
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!