【发布时间】:2015-07-02 05:35:19
【问题描述】:
灰烬:1.13.2
我似乎无法正常工作。
父/子小部件(gridster-container/gridster-widget)
{{#gridster-container}}
{{#each model as |widget|}}
{{#gridster-widget sizeX=widget.sizeX sizeY=widget.sizeY action="addWidget"}}
...
{{/gridster-widget}}
{{/each}}
{{/gridster-container}}
gridster-widget
export default Ember.Component.extend({
tagName : 'li',
sizeX : 1,
sizeY : 1,
widget : null,
didInsertElement : function() {
var sizeX = this.get('sizeX');
var sizeY = this.get('sizeY');
//this.get('parentView').addWidget(this, sizeX, sizeY);
//this.send('addWidget', this, sizeX, sizeY);
//this.sendAction('action', this, sizeX, sizeY);
//this.attrs.action(this, sizeX, sizeY);
//this.get('gridsterContainer').send('addWidget', this, sizeX, sizeY);
//this.action(this, sizeX, sizeY);
this.sendAction('action', this, sizeX, sizeY); //I can see this executing in the debugger.
}
});
在 gridster-container 组件中,我有以下动作来捕获动作。
actions : {
addWidget : function(widget, sizeX, sizeY) {
alert('worked'); //This is never called
}
},
但是该操作从未被调用。
【问题讨论】:
-
你在
gridster-container模板中屈服了吗?如果是这样,组件是兄弟姐妹。
标签: ember.js