停止来自 Ember 操作的点击传播? [英] Stop click propagation from Ember action?
问题描述
我有这样的代码,当点击图标编辑跨度时,它会触发一个打开模态的动作,但是,同时,点击传播到它下面的视图(personView).我希望操作执行并停止传播.
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.
我能想到的唯一解决方案是让图标编辑它自己的视图并通过在方法 click 中返回 false 来停止点击传播.有没有其他方法可以做到这一点而不产生其他观点?
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?
哈佛商学院:
{{#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}}
推荐答案
您也可以在 action
标签中添加 bubbles=false
参数.请参阅API 文档了解如何配置事件传播.
Also you can add bubbles=false
parameter to action
tag. See the API documentation for how to configure event propagation.
这篇关于停止来自 Ember 操作的点击传播?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!