From 181732c1c81f6d3c286c78b0c2a64a17baa25d95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tu=C4=9F=C3=A7e=20K=C3=BC=C3=A7=C3=BCko=C4=9Flu?= Date: Wed, 5 Apr 2023 14:56:29 +0300 Subject: [PATCH] Refactor #3832 Refactor #3833 - For MegaMenu --- api-generator/components/megamenu.js | 6 +++++- components/lib/megamenu/MegaMenu.d.ts | 9 +++++++++ components/lib/megamenu/MegaMenu.vue | 2 +- components/lib/megamenu/MegaMenuSub.vue | 19 ++++++++++++------- 4 files changed, 27 insertions(+), 9 deletions(-) diff --git a/api-generator/components/megamenu.js b/api-generator/components/megamenu.js index cf225f528..cc47ddc71 100644 --- a/api-generator/components/megamenu.js +++ b/api-generator/components/megamenu.js @@ -30,7 +30,11 @@ const MegaMenuSlots = [ }, { name: 'item', - description: 'Template of a menuitem.' + description: 'Custom item template.' + }, + { + name: 'submenuicon', + description: 'Custom submenu icon template.' } ]; diff --git a/components/lib/megamenu/MegaMenu.d.ts b/components/lib/megamenu/MegaMenu.d.ts index 6c7502505..3f33559f8 100755 --- a/components/lib/megamenu/MegaMenu.d.ts +++ b/components/lib/megamenu/MegaMenu.d.ts @@ -70,6 +70,15 @@ export interface MegaMenuSlots { */ item: MenuItem; }): VNode[]; + /** + * Custom submenu icon template. + */ + submenuicon(scope: { + /** + * Whether item is active + */ + active: boolean; + }): VNode[]; } /** diff --git a/components/lib/megamenu/MegaMenu.vue b/components/lib/megamenu/MegaMenu.vue index df0209928..c0530c8b3 100755 --- a/components/lib/megamenu/MegaMenu.vue +++ b/components/lib/megamenu/MegaMenu.vue @@ -18,7 +18,7 @@ :focusedItemId="focused ? focusedItemId : undefined" :items="processedItems" :horizontal="horizontal" - :template="$slots.item" + :template="$slots" :activeItem="activeItem" :exact="exact" :level="0" diff --git a/components/lib/megamenu/MegaMenuSub.vue b/components/lib/megamenu/MegaMenuSub.vue index 107d3d54c..01d4e0410 100644 --- a/components/lib/megamenu/MegaMenuSub.vue +++ b/components/lib/megamenu/MegaMenuSub.vue @@ -17,7 +17,7 @@ :aria-posinset="getAriaPosInset(index)" >
-