This commit is contained in:
jxxghp
2023-06-24 20:25:03 +08:00
parent d637d6cbc6
commit 5e3fd33599
11 changed files with 208 additions and 126 deletions

View File

@@ -1,7 +1,7 @@
<script setup lang="ts">
import type { ThemeSwitcherTheme } from '@layouts/types';
import { ref, watch } from 'vue';
import { useTheme } from 'vuetify';
import { ref, watch } from 'vue'
import { useTheme } from 'vuetify'
import type { ThemeSwitcherTheme } from '@layouts/types'
const props = defineProps<{
themes: ThemeSwitcherTheme[]
@@ -15,6 +15,7 @@ const { state: currentThemeName, next: getNextThemeName, index: currentThemeInde
const changeTheme = () => {
const nextTheme = getNextThemeName()
globalTheme.name.value = nextTheme
savedTheme.value = nextTheme
localStorage.setItem('theme', nextTheme)
@@ -29,7 +30,6 @@ watch(() => globalTheme.name.value, val => {
onMounted(() => {
globalTheme.name.value = savedTheme.value
})
</script>
<template>