[英]How to prevent event bubbling, rightnavbutton? Titanium
Here is my alloy code - snippet: 这是我的合金代码-片段:
<RightNavButton>
<Button id="btnRight" onClick="rightButtonClicked" />
</RightNavButton>
JS: JS:
//edit profile button
function rightButtonClicked(e) {
Ti.API.info("testing bubble ");
//TODO: add functionality here
e.cancelBubble = true;
}
The event still bubbles. 事件仍然冒泡。 Normal buttons this works fine.
普通按钮可以正常工作。
Thanks 谢谢
Update: 更新:
<RightNavButton>
<Button id="btnRight" title='Chat' onClick="rightButtonClicked" bubbleParent='false'/>
</RightNavButton>
Still bubbles. 仍然有气泡。 ie if I click on that multiple times, it keeps on opening windows.
即,如果我多次单击,它将继续打开窗口。 Rather then wait for event to finish and then fire again.
而是等待事件完成,然后再次触发。
尝试
e.stopImmediatePropagation();
you should used bubbleParent property over the button, set it to false it will work. 您应该在按钮上使用bubbleParent属性,将其设置为false即可使用。 Here is the documentation
这是文档
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.