简体   繁体   English

Ember.js路由transitionTo方法不起作用

[英]Ember.js route transitionTo method not working

I have a nested route, and from the action I am transitioning to a different route with query-params , but transitionTo does nothing, doesn't even report an error. 我有一个嵌套的路由,并且从动作中我正在使用query-params过渡到其他路由,但是transitionTo什么也不做,甚至不会报告错误。

The {{link-to}} helper works fine, though. {{link-to}}辅助程序可以正常工作。 But I need to do it with an action. 但是我需要采取行动。

routes.js: route.js:

this.route('parent-route', function() {
    this.route('child-route1');
    this.route('child-route2', {path: '/child-route1/child-route2/:param1/:param2'});
  });

child-route1: 子路由1:

actions: {
    doTransit() {
        this.transitionTo('parent-route.child-route2', {query-params: {'param1': '1', 'param2': '2'}});
    }
}

I have never seen this problem before, what could I be doing wrong? 我以前从未见过此问题,我可能做错了什么?

May be the extra route-name I put in the routes.js file in child-route2 ? 可能是我在child-route2routes.js文件中添加的多余路由名吗? But I need that path there so the URL shows that stuff. 但是我在那里需要该路径,以便URL显示这些内容。 Any help, please? 有什么帮助吗?

也许尝试使用

this.transitionToRoute('parent-route.child-route2', '1', '2')

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

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