components/navigation/navigation: add light/dark theme switcher
All checks were successful
Build dev / build (push) Successful in 1m13s
All checks were successful
Build dev / build (push) Successful in 1m13s
This commit is contained in:
parent
187e432182
commit
ac49090615
1 changed files with 12 additions and 1 deletions
|
@ -1,5 +1,5 @@
|
|||
<script setup>
|
||||
import { useDisplay } from "vuetify/lib/framework.mjs";
|
||||
import { useDisplay, useTheme } from "vuetify/lib/framework.mjs";
|
||||
import { ref } from "vue";
|
||||
import { navigateTo, useRoute } from "#app";
|
||||
|
||||
|
@ -8,6 +8,11 @@ const route = useRoute();
|
|||
const { mobile } = useDisplay();
|
||||
const navOpen = ref(!mobile.value);
|
||||
const navSelected = ref([route.path]);
|
||||
|
||||
const theme = useTheme();
|
||||
function switchTheme() {
|
||||
theme.global.name.value = theme.global.current.value.dark ? 'light' : 'dark';
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
@ -22,5 +27,11 @@ const navSelected = ref([route.path]);
|
|||
<VListItem prepend-icon="mdi-receipt-text" title="Orders" value="/orders" @click="navigateTo('/orders')" />
|
||||
<VDivider />
|
||||
</VList>
|
||||
<template #append>
|
||||
<VList density="compact" nav>
|
||||
<VDivider />
|
||||
<VListItem prepend-icon="mdi-theme-light-dark" title="Switch theme" class="mx-auto" @click="switchTheme()" />
|
||||
</VList>
|
||||
</template>
|
||||
</VNavigationDrawer>
|
||||
</template>
|
||||
|
|
Loading…
Reference in a new issue