vue-router redirect问题

新手上路,请多包涵

为什么/admin redirect重定向到子路由, url路径是localhost:8080/abnormal而不是localhost:8080/admin/abnormal呢

abnormal是通过addRoute动态添加的
image.png
image.png
image.png

阅读 1.8k
1 个回答

vue-router 3.x不支持
源码

resolvePath(path, record.parent ? record.parent.path : '/', true)

如果当前地址即admin的parent为undefined就会替换成/

vue-router 4.x支持你所认知的相对重定向
https://router.vuejs.org/zh/g...

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