forked from Wroclaw/WorkshopTasker
components/navigation/navigation: actually watch for route changes
the useRoute() did not return ref, so the previous implementation did not work
This commit is contained in:
parent
bcace5cbd7
commit
54907d6eec
1 changed files with 4 additions and 4 deletions
|
@ -1,16 +1,16 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { useDisplay, useTheme } from "vuetify/lib/framework.mjs";
|
import { useDisplay, useTheme } from "vuetify/lib/framework.mjs";
|
||||||
import { ref, watch } from "vue";
|
import { ref, watch } from "vue";
|
||||||
import { navigateTo, useRoute } from "#app";
|
import { navigateTo, useRouter } from "#app";
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRouter().currentRoute;
|
||||||
|
|
||||||
const { mobile } = useDisplay();
|
const { mobile } = useDisplay();
|
||||||
const navOpen = ref(!mobile.value);
|
const navOpen = ref(!mobile.value);
|
||||||
const navSelected = ref([route.path]);
|
const navSelected = ref([route.value.path]);
|
||||||
|
|
||||||
watch(route, (v) => {
|
watch(route, (v) => {
|
||||||
navSelected.value = [route.path];
|
navSelected.value = [v.path];
|
||||||
});
|
});
|
||||||
|
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
|
|
Loading…
Reference in a new issue