Vue 项目解决微信分享总是首页的bug

// app.vue 

watch: {

 $route: {

  immediate: true,

  deep: true,

  handler(to) {

   // 微信浏览器判断

   const WECHAT_BROWSER = navigator.userAgent.toLowerCase().includes('micromessenger')

   // 解决iOS微信浏览器分享地址只能是落地页的问题,这个操作是不会刷新页面的,query参数改变也会执行

   if (WECHAT_BROWSER) {

    // eslint-disable-next-line

    window.location.href = window.location.href

   }

  }

},

然后链接用https://xxx.com/?menu#/goods

猜你喜欢

转载自blog.csdn.net/qq_38188485/article/details/103561754