route.matched
时间: 2023-08-15 09:05:12 浏览: 161
$route.matched是一个数组,包含当前路由的所有嵌套路径片段的路由记录。\[1\]\[2\]在导航守卫中,$route.matched数组会暴露为$route对象,可以通过遍历$route.matched来检查路由记录中的meta字段。\[1\]例如,如果当前路由是/a/aa-01,那么$this.$route.matched匹配到的会是一个数组,包含'/','/a','/a/aa-01'这三个path的路由信息。\[3\]可以利用$route.matched来渲染面包屑导航,通过遍历$route.matched数组来获取路由信息并进行渲染。
#### 引用[.reference_title]
- *1* *2* [$route.matched](https://blog.csdn.net/qq_44317018/article/details/105626280)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insert_down1,239^v3^insert_chatgpt"}} ] [.reference_item]
- *3* [vue-router 利用 $route 的 matched 属性实现面包屑效果](https://blog.csdn.net/mochenangel/article/details/109855840)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insert_down1,239^v3^insert_chatgpt"}} ] [.reference_item]
[ .reference_list ]
阅读全文