|
|
@@ -43,9 +43,17 @@ Vue.prototype.$storage = storage
|
|
|
Vue.prototype.$sessionStorage = sessionStorage
|
|
|
|
|
|
// 判断是否为微信浏览器
|
|
|
-Vue.prototype.$isWechat = function() {
|
|
|
+Vue.prototype.$isWechat = () => {
|
|
|
const ua = navigator.userAgent.toLowerCase()
|
|
|
- return ua.indexOf('micromessenger') !== -1
|
|
|
+ const isWeChat = /micromessenger/i.test(ua)
|
|
|
+
|
|
|
+ // 额外验证:检查微信JSBridge
|
|
|
+ if (isWeChat && typeof WeixinJSBridge === 'undefined') {
|
|
|
+ // 这种情况可能发生在某些特殊微信版本或modified UA
|
|
|
+ console.warn('检测到微信UA但无JSBridge,可能是不完整的微信环境')
|
|
|
+ }
|
|
|
+ console.log('$isWechat', isWeChat)
|
|
|
+ return isWeChat
|
|
|
}
|
|
|
|
|
|
// 动态设置title
|