mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-07-23 07:09:41 +02:00
feat: Migrate to Nuxt 3 framework (#5184)
Co-authored-by: Michael Genson <71845777+michael-genson@users.noreply.github.com> Co-authored-by: Kuchenpirat <24235032+Kuchenpirat@users.noreply.github.com>
This commit is contained in:
parent
89ab7fac25
commit
c24d532608
403 changed files with 23959 additions and 19557 deletions
|
@ -1,13 +1,20 @@
|
|||
import { Plugin } from "@nuxt/types"
|
||||
import { useDark } from "@vueuse/core";
|
||||
|
||||
const darkModePlugin: Plugin = ({ $vuetify }, _) => {
|
||||
const isDark = useDark();
|
||||
export default defineNuxtPlugin((nuxtApp) => {
|
||||
const isDark = useDark({
|
||||
onChanged: (v) => {
|
||||
console.log(`changing theme to ${v ? "dark" : "light"} using @vueuse/useDark`);
|
||||
const $vuetify = nuxtApp.vueApp.$nuxt.$vuetify;
|
||||
if ($vuetify)
|
||||
$vuetify.theme.global.name.value = v ? "dark" : "light";
|
||||
},
|
||||
});
|
||||
|
||||
// Vuetify metadata is bugged and doesn't render dark mode fully when called immediately
|
||||
// Adding a delay fixes this problem
|
||||
// https://stackoverflow.com/questions/69399797/vuetify-darkmode-colors-wrong-after-page-reload
|
||||
setTimeout(() => { $vuetify.theme.dark = isDark.value; }, 200);
|
||||
};
|
||||
nuxtApp.hook("vuetify:ready", (vuetify) => {
|
||||
vuetify.theme.global.name.value = isDark.value ? "dark" : "light";
|
||||
});
|
||||
|
||||
export default darkModePlugin;
|
||||
return {
|
||||
provide: {},
|
||||
};
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue