From 2495d6099adf753fb1e2b06de99acbd70c7da4da 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: Tue, 31 Aug 2021 12:16:23 +0300 Subject: [PATCH] Fixed #1488 - activeIndex for TabMenu --- api-generator/components/tabmenu.js | 26 ++++++++++++++++++++++ src/components/tabmenu/TabMenu.d.ts | 1 + src/components/tabmenu/TabMenu.vue | 34 ++++++++++++++++++++++++----- 3 files changed, 56 insertions(+), 5 deletions(-) diff --git a/api-generator/components/tabmenu.js b/api-generator/components/tabmenu.js index 8ac64f24a..de136a868 100644 --- a/api-generator/components/tabmenu.js +++ b/api-generator/components/tabmenu.js @@ -10,6 +10,31 @@ const TabMenuProps = [ type: "boolean", default: "true", description: "Defines if active route highlight should match the exact route path." + }, + { + name: "activeIndex", + type: "number", + default: "0", + description: "Active index of menuitem." + } +]; + +const TabMenuEvents = [ + { + name: "tab-change", + description: "Callback to invoke when an active tab is changed.", + arguments: [ + { + name: "event.originalEvent", + type: "object", + description: "Original event" + }, + { + name: "event.index", + type: "number", + description: "Index of the selected tab" + } + ] } ]; @@ -25,6 +50,7 @@ module.exports = { name: "TabMenu", description: "TabMenu is a navigation component that displays items as tab headers.", props: TabMenuProps, + events: TabMenuEvents, slots: TabMenuSlots } }; diff --git a/src/components/tabmenu/TabMenu.d.ts b/src/components/tabmenu/TabMenu.d.ts index 31942d9c7..a33d7aaa5 100755 --- a/src/components/tabmenu/TabMenu.d.ts +++ b/src/components/tabmenu/TabMenu.d.ts @@ -3,6 +3,7 @@ import { VNode } from 'vue'; interface TabMenuProps { model?: any[]; exact?: boolean; + activeIndex?: number; } declare class TabMenu { diff --git a/src/components/tabmenu/TabMenu.vue b/src/components/tabmenu/TabMenu.vue index 340ca35fa..fbc7c4f01 100755 --- a/src/components/tabmenu/TabMenu.vue +++ b/src/components/tabmenu/TabMenu.vue @@ -5,7 +5,7 @@