Ember CLI 简单验证 RouteMixins 不工作

Ember CLI Simple Auth RouteMixins not working

会话正在运行并且没有显示任何错误,但是 routeMixins 的 none 正在运行......我似乎遇到了一些类似的问题及其解决方案,但不知何故它们没有解决我的问题(或者我误解了他们的实现。)这是我当前的应用程序路由器:

import Ember from 'ember';
import ApplicationRouteMixin from 'simple-auth/mixins/application-route-mixin';

export default Ember.Route.extend
({
    ApplicationRouteMixin,
    model: function()
    {
        return Ember.Object.create
        ({
            genres: this.store.findAll('genre'),
            factTypes: this.store.findAll('factType'),
            categories: this.store.findAll('category')
        });
    },
    setupController: function(controller, models)
    {
        this._super(controller, models);
    }
});

我也尝试了以下但没有成功:

beforeModel: function(transition, queryParams)
{
    this._super(transition, queryParams);
},

model: function(transition, queryParams)
{
    this._super(transition, queryParams);
    return Ember.Object.create
    ({
        genres: this.store.findAll('genre'),
        factTypes: this.store.findAll('factType'),
        categories: this.store.findAll('category')
    });
}

我在我的应用程序中使用的一些 routeMixins:

User.edit

import Ember from 'ember';
import AuthenticatedRouteMixin from 'simple-auth/mixins/authenticated-route-mixin';
export default Ember.Route.extend(AuthenticatedRouteMixin);

登录路径

import Ember from 'ember';
import UnauthenticatedRouteMixin from 'simple-auth/mixins/unauthenticated-route-mixin';

export default Ember.Route.extend
({
    UnauthenticatedRouteMixin,
    setupController: function(controller)
    {
        controller.set('errorMessage', null);
    }
});

我又一次错过了细节...这个特定问题的答案是将 RouteMixins 移动到 export default 左括号之前,如下所示:

申请途径

import Ember from 'ember';
import ApplicationRouteMixin from 'simple-auth/mixins/application-route-mixin';

export default Ember.Route.extend
(ApplicationRouteMixin, {
    model: function()
    {
        return Ember.Object.create
        ({
            genres: this.store.findAll('genre'),
            factTypes: this.store.findAll('factType'),
            categories: this.store.findAll('category')
        });
    }
});

登录路径

import Ember from 'ember';
import UnauthenticatedRouteMixin from 'simple-auth/mixins/unauthenticated-route-mixin';

export default Ember.Route.extend
(UnauthenticatedRouteMixin,{
    setupController: function(controller)
    {
        controller.set('errorMessage', null);
    }
});

我应该删除这个问题,但你永远不知道其他人是否也犯了同样的错误并且很难检测到它...你可以查看文档 here