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

Reorder declaration of props in MainNav.vue, to _before_ it is read. #164

Merged
merged 1 commit into from
Jun 26, 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
11 changes: 6 additions & 5 deletions src/components/navs/MainNav.vue
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,12 @@ const activePrez = computed(() => {
return enabledPrezs.value.find(prez => route.path === `/${prez.toLowerCase()[0]}` || route.path.startsWith(`/${prez.toLowerCase()[0]}/`));
});


const props = defineProps<{
sidenav: boolean;
version: string;
}>();

const collapse = ref(false);
const dropdowns = ref(enabledPrezs.value.reduce<{[key: string]: boolean}>((obj, prez) => (obj[prez] = props.sidenav ? prez === activePrez.value : false, obj), {})); // { CatPrez: false, ... }

Expand All @@ -80,11 +86,6 @@ watch(() => route.path, (newValue) => {
}
});

const props = defineProps<{
sidenav: boolean;
version: string;
}>();

function closeDropdowns() {
if (!Object.values(dropdowns.value).every(isOpen => !isOpen)) { // if any are true
Object.keys(dropdowns.value).forEach(prez => dropdowns.value[prez] = false); // set all to false
Expand Down
Loading