components/navigation/navigation: watch for route changes
All checks were successful
Build dev / build (push) Successful in 1m3s
All checks were successful
Build dev / build (push) Successful in 1m3s
and select value in nav properly
This commit is contained in:
parent
cf29c26abc
commit
bcace5cbd7
1 changed files with 5 additions and 1 deletions
|
@ -1,6 +1,6 @@
|
|||
<script setup>
|
||||
import { useDisplay, useTheme } from "vuetify/lib/framework.mjs";
|
||||
import { ref } from "vue";
|
||||
import { ref, watch } from "vue";
|
||||
import { navigateTo, useRoute } from "#app";
|
||||
|
||||
const route = useRoute();
|
||||
|
@ -9,6 +9,10 @@ const { mobile } = useDisplay();
|
|||
const navOpen = ref(!mobile.value);
|
||||
const navSelected = ref([route.path]);
|
||||
|
||||
watch(route, (v) => {
|
||||
navSelected.value = [route.path];
|
||||
});
|
||||
|
||||
const theme = useTheme();
|
||||
function switchTheme() {
|
||||
theme.global.name.value = theme.global.current.value.dark ? 'light' : 'dark';
|
||||
|
|
Loading…
Reference in a new issue