登路后跳入退出前的路由

  next(`/login?redirect=${to.path}`)

login

    watch: {
      $route: {
        handler(route) {
          this.redirect = (route.query && route.query.redirect) || '/'
        },
        immediate: true,
      },
    },

登录后跳

 const routerPath = this.redirect === '/404' || this.redirect === '/401' ? '/' : this.redirect
                this.$router.push(routerPath).catch(() => {})

 

posted @ 2024-09-19 10:48  ThisCall  阅读(3)  评论(0编辑  收藏  举报