vue 登录成功后跳转回登录前的页面

vue yekong 865℃

在axios拦截器里进行配置

if (router.history.current.fullPath) {
                router.push({path: '/reg/login', query: {url:router.history.current.fullPath}})
            } else {
                router.push({path: '/reg/login', query: {url: ''}})
            }

登录成功后跳转事件

gohome() {
      if (this.$route.query.url) {
        this.$router.push({
          path: this.$route.query.url,
        })
      } else {
        this.$router.push({
          path: '/',
        })
      }
    },
喜欢 (1)