Skip to content

Commit

Permalink
Fixed #1329 - Accordion tab-open and tab-close events
Browse files Browse the repository at this point in the history
  • Loading branch information
tugcekucukoglu committed Jun 14, 2021
1 parent c4490c2 commit c6f1310
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
9 changes: 8 additions & 1 deletion src/components/accordion/Accordion.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -37,6 +39,11 @@ export default {
}
this.$emit('update:activeIndex', this.d_activeIndex);
this.$emit(eventName, {
originalEvent: event,
index: index
});
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/components/accordiontab/AccordionTab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion src/views/accordion/AccordionDoc.vue
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ export default {
<tr>
<td>tab-open</td>
<td>event.originalEvent: Browser event <br/>
event.tab: Opened tab
event.tab: opened tab
</td>
<td>Callback to invoke when a tab gets expanded.</td>
</tr>
Expand Down

0 comments on commit c6f1310

Please sign in to comment.