2

我怀疑这个问题可能与我的路由或我的观点有关。以下是两者:

App.router = Ember.Router.create({
    enableLogging: true,
    location: 'history',
    root: Ember.Route.extend({
        index: Ember.Route.extend({
            route: '/admin/',
            redirectsTo: 'login'
        }),
        login: Ember.Route.extend({
            route: '/admin/login/',
            doLogin: function(router, context) {
                "use strict";
                router.transitionTo('dashboard', context);
            },
            connectOutlets: function (router, context) {
                "use strict";
                router.get('applicationController').connectOutlet('login', "login");
            }
        }),
        dashboard: Ember.Route.extend({
            route: '/admin/dashboard/',
            doLogout: function(router, context) {
                "use strict";
                router.transitionTo('login', context);
            },
            connectOutlets: function (router, context) {
                "use strict";
                router.get('applicationController').connectOutlet('sidebar', 'sidebar');
                router.get('applicationController').connectOutlet('toolbar', 'toolbar');
                router.get('applicationController').connectOutlet('dashboard', 'dashboard');
            }
        }),
        articles: Ember.Route.extend({
            route: '/admin/articles/',
            connectOutlets: function (router, context) {
                "use strict";
                console.log("here");
                router.get('applicationController').connectOutlet('sidebar', 'sidebar');
                router.get('applicationController').connectOutlet('toolbar', 'toolbar');
                router.get('applicationController').connectOutlet('articles', 'articles');
            }
        })
    })
});

我的观点有问题:

<script type="text/x-handlebars" data-template-name="sidebar">
    <div class="logo">
        <img src="http://boxed.hu/static/boxed.hu/images/sitebuild/logo.png">
    </div>
    <ul>
        <li>
            <a id="dashboardMenu" href="" data-module="dashboard" class="selected" {{action dashboard}}>
                Dashboard
                <span class="icon-home"></span>
            </a>
        </li>
        <li>
            <a id="articlesMenu" href="" data-module="articles" class="" {{action articles}}>
                Articles
                <span class="icon-copy"></span>
            </a>
        </li>
        <li>
            <a id="mediaMenu" href="" data-module="media" class="" {{action media}}>
                Media
                <span class="icon-picture"></span>
            </a>
        </li>
        <li>
            <a id="pagesMenu" href="" data-module="pages" class="" {{action pages}}>
                Pages
                <span class="icon-file"></span>
            </a>
        </li>
        <li>
            <a id="commentsMenu" href="" data-module="comments" class="" {{action comments}}>
                Comments
                <span class="icon-comments"></span>
            </a>
        </li>
        <li>
            <a id="usersMenu" href="" data-module="users" class="" {{action users}}>
                Users
                <span class="icon-user"></span>
            </a>
        </li>
        <li>
            <a id="rolesMenu" href="" data-module="roles" class="" {{action roles}}>
                Roles
                <span class="icon-unlock"></span>
            </a>
        </li>
    </ul>
</script>

当我单击列表中的一个元素时,我得到以下控制台输出:

STATEMANAGER: Sending event 'articles' to state root.

TypeError: can't redefine non-configurable property '__ember1346625712617'
[Break On This Error]   

o_defineProperty(this, GUID_KEY, undefinedDescriptor);

我正计划调试代码,但我认为这里的帖子可能会比我的调试带来更快的答案。

4

1 回答 1

3

这不是具体的 Ember 错误,而是浏览器错误:访问器属性错误:无法重新定义不可配置的属性 'status'

我怀疑您将其视为将操作 ( {{action articles}}) 命名为与状态相同的结果。

于 2012-09-03T00:33:19.740 回答