mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-21 04:39:19 +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 }]);
|
content.update((_) => [..._, { ...data, index: _.length }]);
|
||||||
},
|
},
|
||||||
update: (id) => {
|
update: (id) => {
|
||||||
|
if (currentIndex !== $tabsById[id].index) {
|
||||||
currentIndex = $tabsById[id].index;
|
currentIndex = $tabsById[id].index;
|
||||||
|
dispatch("change", currentIndex);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
change: (direction) => {
|
change: (direction) => {
|
||||||
let index = currentIndex + direction;
|
let index = currentIndex + direction;
|
||||||
|
@ -86,8 +89,6 @@
|
||||||
$: currentTab = $tabs[currentIndex] || undefined;
|
$: currentTab = $tabs[currentIndex] || undefined;
|
||||||
$: currentContent = $content[currentIndex] || undefined;
|
$: currentContent = $content[currentIndex] || undefined;
|
||||||
$: {
|
$: {
|
||||||
dispatch("change", currentIndex);
|
|
||||||
|
|
||||||
if (currentTab) {
|
if (currentTab) {
|
||||||
selectedTab.set(currentTab.id);
|
selectedTab.set(currentTab.id);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue