Skip to content

Commit

Permalink
fix(tabs): fix animation
Browse files Browse the repository at this point in the history
  • Loading branch information
mlmoravek committed Feb 23, 2024
1 parent 4899c67 commit ff1a705
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions packages/oruga-next/src/components/tabs/Tabs.vue
Original file line number Diff line number Diff line change
Expand Up @@ -280,17 +280,19 @@ function clickFirstViableChild(startingIndex: number, forward: boolean): void {
/** Activate next child and deactivate prev child */
function performAction(newId: number | string): void {
const oldValue = activeId.value;
const oldTab = isDefined(oldValue)
? items.value.find((item) => item.value === oldValue) || items.value[0]
: items.value[0];
activeId.value = newId;
const oldId = activeId.value;
const oldItem = activeItem.value;
const newItem =
items.value.find((item) => item.value === newId) || items.value[0];
if (oldItem && newItem) {
oldItem.deactivate(newItem.index);
newItem.activate(oldItem.index);
}
nextTick(() => {
if (oldTab && activeItem.value) {
oldTab.deactivate(activeItem.value.index);
activeItem.value.activate(oldTab.index);
}
emits("change", newId, oldValue);
activeId.value = newId;
emits("change", newId, oldId);
});
}
Expand Down

0 comments on commit ff1a705

Please sign in to comment.