From 9d31b6ffa853596b56264c89a65fab9d4ad18b73 Mon Sep 17 00:00:00 2001 From: Jy <1041207253@qq.com> Date: Sun, 29 Mar 2020 16:49:11 +0800 Subject: [PATCH 1/2] fix: defaultActiveFirstOption is true and activeKey is Falsy will return the next child key #1727 --- components/vc-menu/SubPopupMenu.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/vc-menu/SubPopupMenu.jsx b/components/vc-menu/SubPopupMenu.jsx index 8aa8d10d43..a964182ca1 100644 --- a/components/vc-menu/SubPopupMenu.jsx +++ b/components/vc-menu/SubPopupMenu.jsx @@ -65,7 +65,7 @@ export function getActiveKey(props, originalActiveKey) { if (defaultActiveFirst) { loopMenuItem(children, (c, i) => { const propsData = c.componentOptions.propsData || {}; - if (!activeKey && c && !propsData.disabled) { + if (activeKey === null && c && !propsData.disabled) { activeKey = getKeyFromChildrenIndex(c, eventKey, i); } }); From e9e4ba7dbe068b3663adf2c9a15447ada814e72f Mon Sep 17 00:00:00 2001 From: Jy <1041207253@qq.com> Date: Thu, 2 Apr 2020 21:24:50 +0800 Subject: [PATCH 2/2] 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 a964182ca1..d101a7dd60 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 === null && c && !propsData.disabled) { + const noActiveKey = activeKey === null || activeKey === undefined; + if (noActiveKey && c && !propsData.disabled) { activeKey = getKeyFromChildrenIndex(c, eventKey, i); } });