Skip to content

Commit

Permalink
fix(SSR): fix undefined MutationObserver on VTabs when in SSR mode
Browse files Browse the repository at this point in the history
  • Loading branch information
gravitano committed Jan 17, 2023
1 parent db17afa commit a3b00c5
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions packages/tabs/src/VTabs.vue
Original file line number Diff line number Diff line change
Expand Up @@ -127,11 +127,7 @@ const selected = ref(modelValue.value);
const tabRefs = ref<HTMLElement[]>([]);
const tabContent = ref<HTMLDivElement>();
const tabSlider = ref<HTMLDivElement>();
const observer = ref(
new MutationObserver((event) => {
setSlider(selected.value as number);
}),
);
const observer = ref();
watch(tabContent, (val, prev) => {
if (prev) {
Expand Down Expand Up @@ -219,6 +215,9 @@ const setSlider = (index: number) => {
};
onMounted(() => {
observer.value = new MutationObserver(() => {
setSlider(+selected.value);
});
setSlider(+selected.value);
});
Expand Down

0 comments on commit a3b00c5

Please sign in to comment.