停止从Ember动作点击传播? [英] Stop click propagation from Ember action?
问题描述
我想到的唯一解决方案是使图标编辑自己的视图,并通过返回来停止点击传播在方法点击中为false。有没有其他方法可以做到这一点,而不再另外看?
HBS:
{{#查看Blocks.PersonView}}
< span class =inline pull-right icon-edit{{action'modalOpen''modifyPersonPopup''modifyPerson'this}}>< /跨度>
< p class =inline left-left person-name> {{firstNameDelayed}}< / p>
{{/ view}}
您可以将 bubbles = false
参数添加到操作
标签(请参阅 http://emberjs.com/api/classes/Ember.Templates.helpers.html#toc_event-propagation )
I have this code that when icon-edit span is clicked, it fires an action that opens a modal, however, at the same time, the click propagates to the view below it (personView). I want the action to execute and stop the propagation.
The only solution I can think of is to make the icon-edit its own view and stop the click propagation by returning false in method click. Is there any other way of doing this without making another view?
HBS:
{{#view Blocks.PersonView}}
<span class="inline pull-right icon-edit" {{action 'modalOpen' 'modifyPersonPopup' 'modifyPerson' this}}></span>
<p class="inline pull-left person-name">{{firstNameDelayed}}</p>
{{/view}}
Also you can add bubbles=false
parameter to action
tag (see http://emberjs.com/api/classes/Ember.Templates.helpers.html#toc_event-propagation)
这篇关于停止从Ember动作点击传播?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!