1234567891011121314151617181920 |
- /**
- * 检查是否进入个人中心:path以/center开始或者name以center_开始
- * 不是进入个人中心,直接跳出
- * 是进入个人中心:
- * 1.检查是否已经注册路由:
- * 已注册: 跳过
- * 未注册:
- * 1.注册路由至一级的Layout下
- */
- export const isInCenter = (to) => {
- const { path } = to
- if (!path.includes('/center')) return false
- return true
- }
- export const hasCenterRoutes = (router, to) => {
- const routes = router.getRoutes()
- const thisRoute = routes.find((f) => f.path === to.path)
- return thisRoute
- }
|