0
…
inputs: Ember.A(),
inputGroup: computed('inputs.[]', {
get() {
return this.get('inputs').mapBy('value');
},
set(_, values) {
# breakpoint 1
if (values) {
values.forEach(value => {
this.get('inputs').addObject({ id: Symbol(), value: value });
});
}
# breakpoint 2
return this.get('inputs').mapBy('value');
},
}),
...
をし、私は私のapp.hbsこのコンポーネントの2を持っている:私は私のcomponent.jsでこれを持って
{{addon-component inputGroup=firstGroup … }} {{addon-component inputGroup=secondGroup … }}
app.jsで:私の中
…
firstGroup: Ember.A([’[email protected]’]),
secondGroup: Ember.A(),
…
最初のコンポーネント、デバッガon # breakpoint 1
、inputs === []
、# breakpoint 2
、inputs === ['[email protected]']
私の2番目のもの、デバッガon # breakpoint 1
、すでにinputs === [‘[email protected]’]
。 これはどのように可能ですか?
ここでは何が起こっているのか詳しく知るのは難しいです。 https://ember-twiddle.com/を使用して、あなたが見ている問題の再現を作成するのが最善でしょう。 –