mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-20 20:33:02 +00:00
fix tabs on change problem
This commit is contained in:
parent
2aeeb728a2
commit
4c4f0cff5e
1 changed files with 4 additions and 3 deletions
|
@ -46,7 +46,10 @@
|
|||
content.update((_) => [..._, { ...data, index: _.length }]);
|
||||
},
|
||||
update: (id) => {
|
||||
currentIndex = $tabsById[id].index;
|
||||
if (currentIndex !== $tabsById[id].index) {
|
||||
currentIndex = $tabsById[id].index;
|
||||
dispatch("change", currentIndex);
|
||||
}
|
||||
},
|
||||
change: (direction) => {
|
||||
let index = currentIndex + direction;
|
||||
|
@ -86,8 +89,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