Ember.js 创建对象时会出现此问题

Ember.js 创建对象时会出现此问题,ember.js,Ember.js,在新的EmberRC1版本中,我们似乎无法从创建的对象调用超类方法。我有一些标准的mixin和视图,用于创建或扩展到其他对象。我覆盖了一些方法,但仍然需要执行超级方法,我们可以在以前的版本中使用this.\u super()实现这些方法。但是在较新的版本中,当我创建一个对象时,这并没有发生 window.App = Ember.Application.create(); App.Router.map(function(){ this.resource("users"); });

在新的EmberRC1版本中,我们似乎无法从创建的对象调用超类方法。我有一些标准的mixin和视图,用于创建或扩展到其他对象。我覆盖了一些方法,但仍然需要执行超级方法,我们可以在以前的版本中使用
this.\u super()
实现这些方法。但是在较新的版本中,当我创建一个对象时,这并没有发生

    window.App = Ember.Application.create();

App.Router.map(function(){
    this.resource("users");
});

App.UsersView = Ember.ContainerView.extend({
    init : function(){
        this._super();
        this.pushObject(App.TestView.create({
            didInsertElement : function() {
               this.$().append(' <br><h4>Appended at Object</h4> ');
            }
        }))
    }
});

App.TestView=Ember.View.extend({
    templateName:'test',
    didInsertElement : function() {
       this.$().append(' <br><h4>Appended at Class</h4> ');
    }
});
window.App=Ember.Application.create();
App.Router.map(函数(){
这是指资源(“用户”);
});
App.UsersView=Ember.ContainerView.extend({
init:function(){
这个;
这个.pushObject(App.TestView.create({
didInsertElement:函数(){
this.$().append(“
追加到对象”); } })) } }); App.TestView=Ember.View.extend({ templateName:“测试”, didInsertElement:函数(){ 这个.$().append(“
在类中追加”); } });
那么这部分是完全移除了,还是我们可以通过其他方式实现这一超级调用

要理解我的问题,这里是关键


PS:我知道我可以使用其他方法名执行需要的代码,并调用相同的方法。但是如果我有这个解决方案,那就太好了。

您仍然可以从init方法调用它。_super(),它将调用父对象。删除的是对对象调用create并传入init方法。有一个createWithMixin方法仍然允许该功能

这里有一篇关于此功能的非常详细的帖子: