Skip to content

Commit

Permalink
Fix active tab and remove unwanted watch
Browse files Browse the repository at this point in the history
  • Loading branch information
samaradel committed Oct 15, 2024
1 parent 038404b commit a83a58a
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions packages/playground/src/weblets/profile_manager.vue
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@
:tabs="getTabs()"
v-model="activeTab"
:disabled="creatingAccount || activatingAccount || activating"
ref="tabsRef"
@tab:change="
() => {
clearError();
Expand Down Expand Up @@ -524,6 +525,18 @@ watch(
},
{ deep: false },
);
const tabsRef = ref();
function handleTabs() {
const tabs = tabsRef.value?.$el;
if (!tabs) return;
const activeClass = "v-slide-group-item--active";
const tabsButtons = tabs.nextSibling.querySelectorAll("button");
const ButtonsList: HTMLElement[] = Array.from(tabsButtons);
const activeButtonIndex = ButtonsList.findIndex(sibling => sibling.classList.contains(activeClass));
activeTab.value = activeButtonIndex;
}
async function mounted() {
selectedName.value = items.value.filter(item => item.id === selectedItem.value.id)[0].name;
Expand Down Expand Up @@ -562,6 +575,7 @@ function isStoredCredentials() {
}
function getTabs() {
handleTabs();
let tabs = [];
if (isStoredCredentials()) {
tabs = [
Expand Down Expand Up @@ -630,10 +644,6 @@ watch(
},
{ immediate: true },
);
watch(
() => [online, props.modelValue],
([newOnline, newModelValue], [oldOnline, oldModelValue]) => {},
);
function logout() {
sessionStorage.removeItem("password");
Expand Down

0 comments on commit a83a58a

Please sign in to comment.