登路後跳入退出前的路由

ThisCall發表於2024-09-19
  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(() => {})

相關文章