From da6d243e9e0cd558412f652fa7d08b56cba8790a Mon Sep 17 00:00:00 2001 From: tangjinzhou <415800467@qq.com> Date: Mon, 23 Nov 2020 00:21:18 -0600 Subject: [PATCH] Perf menu2.0 (#3243) close #3231 #3188 --- CHANGELOG.zh-CN.md | 1 - antdv-demo | 2 +- components/menu/SubMenu.tsx | 7 +- .../__tests__/__snapshots__/demo.test.js.snap | 214 ++---------------- components/menu/__tests__/index.test.js | 144 ++++++------ components/menu/index.tsx | 6 +- components/menu/style/index.less | 2 +- components/table/filterDropdown.tsx | 6 +- components/table/interface.ts | 8 +- components/table/style/size.less | 4 +- .../__tests__/__snapshots__/demo.test.js.snap | 14 ++ components/vc-mentions/src/DropdownMenu.jsx | 5 +- components/vc-menu/DOMWrap.jsx | 4 +- components/vc-menu/Divider.jsx | 2 +- components/vc-menu/FunctionProvider.jsx | 13 +- components/vc-menu/InjectExtraProps.js | 42 ++++ components/vc-menu/Menu.jsx | 143 +++++++----- components/vc-menu/MenuItem.jsx | 79 +++---- components/vc-menu/SubMenu.jsx | 209 ++++++++--------- components/vc-menu/SubPopupMenu.jsx | 114 +++++----- components/vc-menu/commonPropsType.js | 4 +- components/vc-menu/util.js | 32 +-- examples/App.vue | 57 ++--- 23 files changed, 497 insertions(+), 615 deletions(-) create mode 100644 components/vc-menu/InjectExtraProps.js diff --git a/CHANGELOG.zh-CN.md b/CHANGELOG.zh-CN.md index 9752d59982..72f1734356 100644 --- a/CHANGELOG.zh-CN.md +++ b/CHANGELOG.zh-CN.md @@ -10,7 +10,6 @@ --- - ## 2.0.0-rc.1 `2020-11-14` diff --git a/antdv-demo b/antdv-demo index 7cccccbb55..ef82783952 160000 --- a/antdv-demo +++ b/antdv-demo @@ -1 +1 @@ -Subproject commit 7cccccbb5571e61b35aca0d454eb83bc5924995e +Subproject commit ef827839524b6f1ed427aefa082adb09ac2cc95f diff --git a/components/menu/SubMenu.tsx b/components/menu/SubMenu.tsx index 10f2f13695..24edc9dbff 100644 --- a/components/menu/SubMenu.tsx +++ b/components/menu/SubMenu.tsx @@ -1,8 +1,6 @@ import { defineComponent, inject } from 'vue'; import { SubMenu as VcSubMenu } from '../vc-menu'; import classNames from '../_util/classNames'; -import Omit from 'omit.js'; -import { getSlot } from '../_util/props-util'; import { injectExtraPropsKey } from '../vc-menu/FunctionProvider'; export type MenuTheme = 'light' | 'dark'; @@ -38,8 +36,7 @@ export default defineComponent({ popupClassName: classNames(`${rootPrefixCls}-${antdMenuTheme}`, popupClassName), ref: 'subMenu', ...$attrs, - ...Omit($slots, ['default']), - }; - return {getSlot(this)}; + } as any; + return ; }, }); diff --git a/components/menu/__tests__/__snapshots__/demo.test.js.snap b/components/menu/__tests__/__snapshots__/demo.test.js.snap index 2413edfe2b..4266989b95 100644 --- a/components/menu/__tests__/__snapshots__/demo.test.js.snap +++ b/components/menu/__tests__/__snapshots__/demo.test.js.snap @@ -6,8 +6,7 @@ exports[`renders ./antdv-demo/docs/menu/demo/horizontal.md correctly 1`] = ` @@ -17,8 +16,7 @@ exports[`renders ./antdv-demo/docs/menu/demo/horizontal.md correctly 1`] = ` @@ -28,22 +26,19 @@ exports[`renders ./antdv-demo/docs/menu/demo/horizontal.md correctly 1`] = ` @@ -53,8 +48,7 @@ exports[`renders ./antdv-demo/docs/menu/demo/horizontal.md correctly 1`] = ` @@ -98,52 +92,12 @@ exports[`renders ./antdv-demo/docs/menu/demo/inline.md correctly 1`] = ` @@ -169,7 +123,7 @@ exports[`renders ./antdv-demo/docs/menu/demo/inline-collapsed.md correctly 1`] =