Skip to content

Commit

Permalink
fix: moves to the right card depending on route (#3544)
Browse files Browse the repository at this point in the history
  • Loading branch information
amir20 authored Jan 12, 2025
1 parent e8eef82 commit 3f86080
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions assets/components/common/Carousel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,16 @@ const scrollToItem = (index: number) => {
};
const { pause, resume } = watchPausable(activeId, (v) => {
if (activeId.value) {
const index = cards.value?.map((c) => c.id).indexOf(activeId.value) ?? -1;
if (index !== -1) {
console.log("watching", activeId.value);
scrollToItem(index);
}
}
});
watchOnce(cards, () => {
if (activeId.value) {
const index = cards.value?.map((c) => c.id).indexOf(activeId.value) ?? -1;
if (index !== -1) {
Expand Down

0 comments on commit 3f86080

Please sign in to comment.