SanHQin 2 月之前
父节点
当前提交
8fb6e7f401

文件差异内容过多而无法显示
+ 0 - 0
dist/index.html


文件差异内容过多而无法显示
+ 1 - 1
dist/report.html


文件差异内容过多而无法显示
+ 0 - 0
dist/static/css/chunk-0cb64e9d.8812e1c8.css


文件差异内容过多而无法显示
+ 0 - 0
dist/static/js/app.89f67ea2.js


文件差异内容过多而无法显示
+ 0 - 0
dist/static/js/chunk-0cb64e9d.95d3ef58.js


+ 6 - 5
src/components/weChatQrcode.vue

@@ -52,6 +52,11 @@ export default {
             }
           })
         })
+        wx.error(function(res) {
+          console.log('测试测试111')
+          that.close()
+          alert('出错了👉' + res.errMsg) // wx.config配置错误,会弹出窗口哪里错误,然后根据微信文档查询即可。
+        })
       } catch (error) {
         console.log(error)
       }
@@ -75,11 +80,7 @@ export default {
           jsApiList: ['scanQRCode', 'checkJsApi'] // 必填,需要使用的JS接口列表
         }
         wx.config(params)
-        wx.error(function(res) {
-          console.log('测试测试111')
-          that.close()
-          alert('出错了👉' + res.errMsg) // wx.config配置错误,会弹出窗口哪里错误,然后根据微信文档查询即可。
-        })
+
         console.log('测试测试wxConfig')
       } catch (error) {
         console.log(error)

+ 10 - 2
src/main.js

@@ -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

部分文件因为文件数量过多而无法显示