[英]How do I access properties from within an Ember 2 component?
我在訪問傳遞給我的Ember組件的屬性時遇到一些麻煩,如下所示:
import Ember from 'ember';
export default Ember.Component.extend({
isRowEditorActive: function() {
return this.get('items').length > 0;
}.property('items'),
actions: {
// My actions here
}
});
我傳入的items
(字符串列表)可以在模板{{line-items-table items=['asd', 'asd']}}
訪問而不會出現問題
但是試圖get
他們中的分量剛剛返回undefined。 有什么建議么?
正如@kristjan所說,您需要為父 items
中的line-item-table
定義items
。
這是因為當前版本的把手不支持內聯數組https://github.com/wycats/handlebars.js/issues/1058
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.