Problems in the custom menu jump of the vue Wechat official account project

Wechat official account project, the link to the custom menu is to jump to the personal information page of the project.
does the logic in main.js. If you don"t log in, you will jump to the login page, and then jump to the personal information page after logging in.
but if you enter through a custom menu, if you are not logged in, the personal information page will appear first each time, and then jump to the registration page. How can this situation be optimized?

Jun.28,2021

can be handled in the beforeEach hook of the route so that it does not enter the personal information page.

router.beforeEach (to, from, next) {
  if (to.path === '/login') {
    next()
  } else {
    if (isLogin) {
      next()
    } else {
      next({path: '/login'})
    }
  }
}

Don't write the second jump page after authorization, use location.href

Menu