feat(dropdown): click 回调中传递事件对象 (#2273)

pull/2284/head
morning-star 1 month ago committed by GitHub
parent e7d4ea634d
commit 6159468f82
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -288,10 +288,11 @@ ready: function(elemPanel, elem){
</div>
```
click: function(data, othis){
click: function(data, othis, event){
console.log(data); // 当前所点击的菜单项对应的数据
console.log(othis); // 当前所点击的菜单项元素对象
console.log(this.elem); // 当前组件绑定的目标元素对象,批量绑定中常用
console.log(event); // 事件对象 2.9.18+
// 若返回 false则点击选项可不关闭面板 --- 2.8+
/*

@ -340,7 +340,7 @@ layui.define(['jquery', 'laytpl', 'lay', 'util'], function(exports){
// 普通菜单项点击后的回调及关闭面板
if((!isChild || isClickAllScope) && data.type !== '-'){
var ret = typeof options.click === 'function'
? options.click(data, othis)
? options.click(data, othis, e)
: null;
ret === false || (isChild || that.remove());

Loading…
Cancel
Save