停止从Ember动作点击传播? [英] Stop click propagation from Ember action?

查看:125
本文介绍了停止从Ember动作点击传播?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这个代码,当图标编辑跨度被点击时,它触发一个打开模态的操作,但同时,点击传播到它下面的视图(personView)。我想要该动作执行并停止传播。



我想到的唯一解决方案是使图标编辑自己的视图,并通过返回来停止点击传播在方法点击中为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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆