Procházet zdrojové kódy

only update tailwind.config.darkMode if value has changed
(fixes #2446)

Rodja Trappe před 1 rokem
rodič
revize
56c742ec79
1 změnil soubory, kde provedl 2 přidání a 1 odebrání
  1. 2 1
      nicegui/elements/dark_mode.js

+ 2 - 1
nicegui/elements/dark_mode.js

@@ -9,7 +9,8 @@ export default {
     update() {
       Quasar.Dark.set(this.value === null ? "auto" : this.value);
       if (window.tailwind) {
-        tailwind.config.darkMode = this.value === null ? "media" : "class";
+        const mode = this.value === null ? "media" : "class";
+        if (mode !== tailwind.config.darkMode) tailwind.config.darkMode = mode;
         if (this.value) document.body.classList.add("dark");
         else document.body.classList.remove("dark");
       }