[英]Prevent the disappear of Dropdown menu using bootstrapDropdown when clicking on the list
I am using using bootstrap-dropdown to generate a Dropdown menu. 我正在使用bootstrap-dropdown生成下拉菜单。 I would like to prevent the disappearing of the menu when click on it. 我想在点击它时防止菜单消失。
I have implemented the following code, but it does not work. 我已经实现了以下代码,但它不起作用。 Any idea how to fix it? 知道怎么解决吗?
<li class="dropdown notification">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
<span class="notification-label label label-info">
<i class="icon-inbox icon-white"></i>
<span class="notification-number">{{ unread_notifications }}</span>
</span>
</a>
<ul class="dropdown-menu notification-list"></ul>
</li>
events: {
'click ul.notification-list': 'onClickNotification'
},
onClickNotification: function (e) {
e.preventDefault();
console.log(e);
},
Did you try with event.stopPropagation
? 你尝试过event.stopPropagation
吗?
onClickNotification: function (e) {
e.stopPropagation();
console.log(e)
},
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.