0

所以,我有这个代码:

{{#if isClient}}
    {{view Ember.Select
            value=country
            content=options.country
            prompt='Please select a country'}}
{{/if}}

加载时效果很好,因为isClient默认为true。但是,当我设置isCLient为 false 时,我收到此错误:

Cannot read property 'selectedIndex' of undefined

对底层代码有更好理解的人在这里有什么想法吗?

4

1 回答 1

0

好的,所以我发现了问题所在。

我正在使用 ember-animate 库并调用:

Ember.View.reopen({
    willAnimateIn: function () {
        this.$().hide();
    },
    animateIn: function (done) {
        this.$().fadeIn(250, done);
    },
    animateOut: function (done) {
        this.$().fadeOut(250, done);
    },
});

由于 Ember.Select 是一个视图,因此动画功能在它应该出现和消失时被调用。所以,我只是将上面的内容更改为:

Ember.AnimatedView = Ember.View.extend({

一切都很好。

于 2014-10-10T23:52:51.610 回答