Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix active tab content #3528

Merged
merged 2 commits into from
Oct 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 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,19 @@ watch(
},
{ deep: false },
);
const tabsRef = ref();

function handleTabs() {
const tabs = tabsRef.value?.$el;
if (!tabs) return;
if (!isStoredCredentials()) 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 +576,7 @@ function isStoredCredentials() {
}

function getTabs() {
handleTabs();
let tabs = [];
if (isStoredCredentials()) {
tabs = [
Expand Down Expand Up @@ -630,10 +645,6 @@ watch(
},
{ immediate: true },
);
watch(
() => [online, props.modelValue],
([newOnline, newModelValue], [oldOnline, oldModelValue]) => {},
);

function logout() {
sessionStorage.removeItem("password");
Expand Down
Loading