lin-xin / vue-manage-system

Vue3、Element Plus、typescript后台管理系统
https://lin-xin.github.io/example/vue-manage-system/
MIT License
18.77k stars 6.01k forks source link

chore: 路由守卫vue2 -> vue3 #385

Closed AlliotTech closed 4 months ago

AlliotTech commented 5 months ago

和 Vue 2 不同,Vue 2 的 beforeEach 是默认三个参数,第三个参数是 next,用来操作路由接下来的跳转。

但在新版本路由里,已经通过 RFC 将其删除,虽然目前还是作为可选参数使用,但以后不确定是否会移除,不建议继续使用,点击查看原因

新版本路由可以通过 return 来代替 next。

文档: https://github.com/vuejs/rfcs/blob/master/active-rfcs/0037-router-return-guards.md#motivation