From 6159468f8282e97bcf4db3a0f60adc3c1bd98ba4 Mon Sep 17 00:00:00 2001 From: morning-star <26325820+Sight-wcg@users.noreply.github.com> Date: Mon, 14 Oct 2024 09:35:32 +0800 Subject: [PATCH] =?UTF-8?q?feat(dropdown):=20click=20=E5=9B=9E=E8=B0=83?= =?UTF-8?q?=E4=B8=AD=E4=BC=A0=E9=80=92=E4=BA=8B=E4=BB=B6=E5=AF=B9=E8=B1=A1?= =?UTF-8?q?=20(#2273)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/dropdown/detail/options.md | 3 ++- src/modules/dropdown.js | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/dropdown/detail/options.md b/docs/dropdown/detail/options.md index 5a88c7b5..27ac59f1 100644 --- a/docs/dropdown/detail/options.md +++ b/docs/dropdown/detail/options.md @@ -288,10 +288,11 @@ ready: function(elemPanel, elem){ ``` -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+ /* diff --git a/src/modules/dropdown.js b/src/modules/dropdown.js index f861d3a0..411e78d9 100644 --- a/src/modules/dropdown.js +++ b/src/modules/dropdown.js @@ -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());