【问题标题】:Change URL in component action在组件操作中更改 URL
【发布时间】:2016-01-13 23:38:26
【问题描述】:

当“某事”发生时,我需要更改 URL。所以我做了一个动作,当我调用那个动作时,我希望改变发生:

export default Component.extend({
    // ... 

    actions: {
        test: function(){
            this.transitionTo("dashboard");
        }
    },

    testHandle: function()
    {
        this.send("test");
    },
});

我使用的是 ember 1.13。并在动作脚本启动后将其抛出到控制台:

Deprecations were detected, see the Ember Inspector deprecations tab for more details.
Uncaught TypeError: Cannot read property 'enter' of undefined(…)

有什么想法吗?谢谢。

【问题讨论】:

    标签: javascript redirect ember.js components


    【解决方案1】:

    AFAIK,Ember.Component 没有 transitionTo 方法。您需要从组件发送一个动作并在控制器中处理它。 Docs

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-06-03
      • 2013-01-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-11-16
      • 1970-01-01
      相关资源
      最近更新 更多