nav: select automatically current page when visiting first time
for example after refresh, or when component gets loaded
This commit is contained in:
parent
10ff342991
commit
f7519f32b3
1 changed files with 5 additions and 2 deletions
|
@ -1,10 +1,13 @@
|
|||
<script setup>
|
||||
import { useDisplay } from "vuetify/lib/framework.mjs";
|
||||
import { ref } from "vue";
|
||||
import { navigateTo } from "#app";
|
||||
import { navigateTo, useRoute } from "#app";
|
||||
|
||||
const route = useRoute();
|
||||
|
||||
const { mobile } = useDisplay();
|
||||
const navOpen = ref(!mobile.value);
|
||||
const navSelected = ref([route.path]);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
@ -13,7 +16,7 @@ const navOpen = ref(!mobile.value);
|
|||
<VToolbarTitle>Database Project</VToolbarTitle>
|
||||
</VAppBar>
|
||||
<VNavigationDrawer v-model="navOpen" :temporary="mobile">
|
||||
<VList density="compact" nav>
|
||||
<VList v-model:selected="navSelected" density="compact" nav>
|
||||
<VListItem prepend-icon="mdi-login" title="Login" value="/login" @click="navigateTo('/login')" />
|
||||
<VListItem prepend-icon="mdi-account" title="Clients" value="/clients" @click="navigateTo('/clients')" />
|
||||
<VDivider />
|
||||
|
|
Loading…
Reference in a new issue