且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

使用父路径的查询参数刷新子路径中的模型

更新时间:2023-01-18 11:26:29

我遇到了同样的问题。

使用主路由的queryParams完全足够。
您无需在子路由中添加任何queryParams。
refreshModel设置属于主路由,所有子路由也会刷新。

It is completely enough to use the queryParams of the "main" route. You don't need to add any queryParams to the sub-routes. The refreshModel setting belongs to the main-route and all child routes will refresh as well.

也可以将其用于子路由模型:

this.paramsFor('main')

Also you can use for the sub-routes model: this.paramsFor(‘main’)

请参阅: https:// describe.emberjs.com/t/refresh-model-when-the-queryparam-of-a-parent-route-changes/14903/2