2012-05-07 55 views
1

我有以下StateManager:在ViewState中调用this._super()的正确方法是什么?

App.wrapperView = Em.ContainerView.create(); 
App.wrapperView.append(); 

App.states = Em.StateManager.create({ 
    rootView: App.wrapperView, 
    initialState: "loading", 
    loading: Em.ViewState.create({ 
     view: App.LoadingView, 
     enter: function() { 
      this._super() // _super is not defined. 
      // other stuff goes here 
     } 
    }) 
}); 

因此,我不能保持添加行为。

我应该如何继续?

回答

3
enter: function(manager, transition) { 
    this._super(manager, transition); 
} 

此处了解详情:http://docs.emberjs.com/#doc=Ember.StateManager&src=false

+9

或者你可以做' this._super.apply(这一点,参数)'使其成为动态的 - 或在coffeescript中,'@_super(arguments ...)' –

1

我经常这样做:

this._super(...arguments);

它减少了击键次数,并得到transpiled到

this._super.apply(this, arguments);

相关问题