2012-05-07 53 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);

相關問題