snow пре 1 година
родитељ
комит
b7b1f2c49d
2 измењених фајлова са 7 додато и 1 уклоњено
  1. 3 0
      .npmrc
  2. 4 1
      src/hooks/theme.ts

+ 3 - 0
.npmrc

@@ -1,2 +1,5 @@
 shamefully-hoist=true
 strict-peer-dependencies=false
+
+auto-install-peers=true
+strict-peer-dependencies=false

+ 4 - 1
src/hooks/theme.ts

@@ -7,10 +7,13 @@ export function useTheme() {
 
   function toggleTheme() {
     const _theme = theme.value === "dark" ? "light" : "dark";
-    mode.value = _theme;
     theme.value = _theme;
   }
 
+  watch(() => theme.value, newVal => mode.value = newVal, {
+    immediate: true,
+  });
+
   const isDarkTheme = computed(() => theme.value === "dark");
 
   return {