js判断是否是微信浏览器以及重定向

  async created () {//这个是判断是否是微信浏览器,
    let ua = navigator.userAgent.toLowerCase()
    if (ua.match(/MicroMessenger/i) === 'micromessenger') {
      /* eslint-disable no-unused-vars */
      let result = await this._axios('get', 'WeixinApi/checkWxlogin', {headers: {'page-url': document.location.href}})
      // 只能使用当前的界面的地址.
      let url = encodeURIComponent(location.href.split('#')[0])
      Weixin.getSign(url)
    } else {
      return false
    }
  },
原文地址:https://www.cnblogs.com/cczlovexw/p/7778638.html