feat: daisyui theme toggle

This commit is contained in:
Alisa | Side.one 2023-05-04 23:38:36 +08:00
parent b6a4b9e362
commit dbddd6beb6
2 changed files with 3 additions and 1 deletions

View File

@ -29,10 +29,12 @@ const changeMode = (val: 'dark' | 'light' | 'system') => {
if (value === 'dark') {
document.documentElement.classList.add('dark');
document.documentElement.classList.remove('light');
} else {
document.documentElement.classList.add('light');
document.documentElement.classList.remove('dark');
}
document.documentElement.setAttribute("data-theme", value);
};
// Update icon if theme is changed from other sources
watch(theme, (val: 'dark' | 'light' | 'system') => {

View File

@ -20,6 +20,6 @@ const themes: ThemeSwitcherTheme[] = [
<template>
<div>
<NewThemeSwitcher :themes="themes"/>
<ThemeSwitcher :themes="themes" />
<!-- <ThemeSwitcher :themes="themes" /> -->
</div>
</template>