简体   繁体   English

路由使用 isActive 的确切路径?

[英]Routify exact path for using isActive?

I'm building a restaurant review site using Svelte and Routify, I have a path "./reviews" that shows the current user's own reviews, and paths for reviews on different categories of restaurants, ie "./reviews/mexican" or "./reviews/asian", when the I click on the Mexican's tab, both the "./reviews" and "./reviews/mexican" seem to get turned on as isActive, how do I set exact paths in Routify?我正在使用 Svelte 和 Routify 构建餐厅评论网站,我有一个路径“./reviews”,显示当前用户自己的评论,以及不同类别餐厅评论的路径,即“./reviews/mexican”或“ ./reviews/asian”,当我点击墨西哥的选项卡时,“./reviews”和“./reviews/mexican”似乎都被打开为 isActive,我如何在 Routify 中设置确切的路径?

Thanks!谢谢!

This should work这应该工作

$isActive('/path/to/component', { /* params */ }, { strict: true})

With strict set to false, the path would default to /path/to/component/index and thus wouldn't match any descendent components.将 strict 设置为 false,路径将默认为/path/to/component/index ,因此不会匹配任何后代组件。

https://routify.dev/docs/helpers#is-active https://routify.dev/docs/helpers#is-active

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM