Primitives

useCurrentMatches

编辑此页面

useCurrentMatches 返回当前匹配路由的所有匹配项。这对于获取所有路由信息非常有用。

例如,如果你在路由定义中存储了面包屑导航,你可以像这样获取它们:

const matches = useCurrentMatches();
const breadcrumbs = createMemo(() =>
matches().map((m) => m.route.info.breadcrumb)
);
报告此页面问题