dark mode is now stored in local storage

This commit is contained in:
zurdi zurdo
2023-03-10 17:58:36 +01:00
parent 8bfb4b3cb1
commit aa2d24302a
3 changed files with 10 additions and 4 deletions

View File

@@ -1,7 +1,11 @@
<script setup>
import { ref } from 'vue'
import { useTheme } from "vuetify";
import PlatformsBar from '@/components/PlatformsBar.vue'
const currentPlatform = ref("")
var currentPlatform = ref("")
useTheme().global.name.value = localStorage.getItem('theme')
</script>
<template>
@@ -15,5 +19,5 @@ const currentPlatform = ref("")
</v-container>
</v-main>
</v-app>
</v-app>
</template>

View File

@@ -27,9 +27,10 @@ const scan = (overwrite) => {
}
const theme = useTheme();
const darkMode = ref(true);
const darkMode = (localStorage.getItem('theme') == 'dark') ? ref(true) : ref(false)
const toggleTheme = () => {
theme.global.name.value = darkMode.value ? "dark" : "light"
theme.global.name.value = darkMode.value ? "dark" : "light"
darkMode.value ? localStorage.setItem('theme', 'dark') : localStorage.setItem('theme', 'light')
}
</script>

View File

@@ -1,5 +1,6 @@
<script setup>
import axios from 'axios'
defineProps({ currentPlatform: { type: String, required: false } })
const mockRoms = {