mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-15 10:21:05 +00:00
Fix: Tabs dispatch change event on init (#882)
* fix tabs on change problem * fix(tabs): dispatch change event in update/change context methods Co-authored-by: metonym <ericyl.us@gmail.com>
This commit is contained in:
parent
1aad3153b5
commit
9bbc7698a9
1 changed files with 2 additions and 2 deletions
|
@ -52,6 +52,7 @@
|
|||
},
|
||||
update: (id) => {
|
||||
currentIndex = $tabsById[id].index;
|
||||
dispatch("change", currentIndex);
|
||||
},
|
||||
change: (direction) => {
|
||||
let index = currentIndex + direction;
|
||||
|
@ -77,6 +78,7 @@
|
|||
}
|
||||
|
||||
currentIndex = index;
|
||||
dispatch("change", currentIndex);
|
||||
},
|
||||
});
|
||||
|
||||
|
@ -91,8 +93,6 @@
|
|||
$: currentTab = $tabs[currentIndex] || undefined;
|
||||
$: currentContent = $content[currentIndex] || undefined;
|
||||
$: {
|
||||
dispatch("change", currentIndex);
|
||||
|
||||
if (currentTab) {
|
||||
selectedTab.set(currentTab.id);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue