vue路又返回时的问题

 
 我从/audit ==> /auditlist
 $router.back(-1) 却返回到了 / 就是默认的首页,请问什么毛病
 
 routes: [
    {
      path: '',
      component: Home,
      children: [
        {
          path: '/',
          component: Explorer,
          name: "Explorer"
        },
        {
          path: '/audit',
          component: Audit,
          name: "Audit",
        },
        {
          path: '/auditlist',
          component: AuditList,
          name: "AuditList"
        },
      ]
    },
    {
      path:'/login',
      component: Login,
      name: "Login",
    }
  ]
阅读 1.1k
2 个回答

你跳转的时候是怎么跳的

这个得看你的点击历史了。
正常都是通过window.history.length来判断是否存在上一级
如果没有 则直接首页

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题