mirror of
https://github.com/HangarMC/Hangar.git
synced 2025-01-24 14:24:47 +08:00
Fix ref
This commit is contained in:
parent
a88779bacc
commit
6b33e3dd1e
@ -1,6 +1,5 @@
|
||||
<script setup lang="ts">
|
||||
import { useHead } from "@vueuse/head";
|
||||
import {ref} from 'vue';
|
||||
import { useSeo } from "~/composables/useSeo";
|
||||
import { useThemeStore } from '~/store/theme'
|
||||
|
||||
@ -15,7 +14,7 @@ if (typeof window !== 'undefined') {
|
||||
theme.darkMode = (localStorage.theme === 'dark' || (!('theme' in localStorage) && window.matchMedia('(prefers-color-scheme: dark)').matches));
|
||||
|
||||
|
||||
if (unref(theme.darkMode)){
|
||||
if (theme.darkMode){
|
||||
document.documentElement.classList.add('dark');
|
||||
}else{
|
||||
document.documentElement.classList.add('light');
|
||||
|
@ -1,8 +1,8 @@
|
||||
import { defineStore } from 'pinia'
|
||||
import {ref, unref} from 'vue';
|
||||
import {Ref, ref, unref} from 'vue';
|
||||
|
||||
export const useThemeStore = defineStore('theme', () => {
|
||||
const darkMode = ref(false);
|
||||
const darkMode: Ref<boolean> = ref(false);
|
||||
|
||||
|
||||
function toggleDarkMode() {
|
||||
|
Loading…
Reference in New Issue
Block a user