From c6f1310bbe5fad982e585776eb9f140f19a73ca3 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: Mon, 14 Jun 2021 10:04:40 +0300 Subject: [PATCH] Fixed #1329 - Accordion tab-open and tab-close events --- src/components/accordion/Accordion.vue | 9 ++++++++- src/components/accordiontab/AccordionTab.vue | 4 ++-- src/views/accordion/AccordionDoc.vue | 2 +- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/components/accordion/Accordion.vue b/src/components/accordion/Accordion.vue index 2e900fa17e..2688088bda 100755 --- a/src/components/accordion/Accordion.vue +++ b/src/components/accordion/Accordion.vue @@ -21,7 +21,9 @@ export default { } }, methods: { - onToggle(tab, index) { + onToggle(event, tab, index, isActive) { + const eventName = isActive ? 'tab-close' : 'tab-open'; + if (this.multiple) { let x = this.d_activeIndex; @@ -37,6 +39,11 @@ export default { } this.$emit('update:activeIndex', this.d_activeIndex); + + this.$emit(eventName, { + originalEvent: event, + index: index + }); } } } diff --git a/src/components/accordiontab/AccordionTab.vue b/src/components/accordiontab/AccordionTab.vue index b411e833b6..99326067eb 100755 --- a/src/components/accordiontab/AccordionTab.vue +++ b/src/components/accordiontab/AccordionTab.vue @@ -38,9 +38,9 @@ export default { }) }, methods: { - onTabClick() { + onTabClick(event) { if (!this.disabled) { - this.$parent.onToggle(this, DomHandler.index(this.$el)); + this.$parent.onToggle(event, this, DomHandler.index(this.$el), this.isTabActive()); } }, onTabKeydown(event) { diff --git a/src/views/accordion/AccordionDoc.vue b/src/views/accordion/AccordionDoc.vue index 878e480296..1f23beedf7 100755 --- a/src/views/accordion/AccordionDoc.vue +++ b/src/views/accordion/AccordionDoc.vue @@ -237,7 +237,7 @@ export default { tab-open event.originalEvent: Browser event
- event.tab: Opened tab + event.tab: opened tab Callback to invoke when a tab gets expanded.