components/navigation/navigation: watch for route changes
All checks were successful
Build dev / build (push) Successful in 1m3s

and select value in nav properly
This commit is contained in:
Wroclaw 2023-12-21 03:31:33 +01:00
parent cf29c26abc
commit bcace5cbd7

View file

@ -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';