From 94b701c0778645fd76749efb7337467f4a9ab83d Mon Sep 17 00:00:00 2001 From: Jy <1041207253@qq.com> Date: Sat, 4 Apr 2020 15:07:59 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20defaultActiveFirstOption=20is=20true=20a?= =?UTF-8?q?nd=20activeKey=20is=20Falsy=20will=20ret=E2=80=A6=20(#1979)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: defaultActiveFirstOption is true and activeKey is Falsy will return the next child key #1727 * fix: defaultActiveFirstOption is true and activeKey is undefined #1727 --- components/vc-menu/SubPopupMenu.jsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/components/vc-menu/SubPopupMenu.jsx b/components/vc-menu/SubPopupMenu.jsx index 8aa8d10d4..d101a7dd6 100644 --- a/components/vc-menu/SubPopupMenu.jsx +++ b/components/vc-menu/SubPopupMenu.jsx @@ -65,7 +65,8 @@ export function getActiveKey(props, originalActiveKey) { if (defaultActiveFirst) { loopMenuItem(children, (c, i) => { const propsData = c.componentOptions.propsData || {}; - if (!activeKey && c && !propsData.disabled) { + const noActiveKey = activeKey === null || activeKey === undefined; + if (noActiveKey && c && !propsData.disabled) { activeKey = getKeyFromChildrenIndex(c, eventKey, i); } });