save
This commit is contained in:
@@ -1,15 +1,16 @@
|
||||
import {useBaseStore} from "@/stores/base.ts";
|
||||
import {useSettingStore} from "@/stores/setting.ts";
|
||||
|
||||
export default function useTheme() {
|
||||
const store = useBaseStore()
|
||||
const settingStore = useSettingStore()
|
||||
|
||||
function toggle() {
|
||||
if (store.theme === 'auto') {
|
||||
store.theme = 'dark'
|
||||
if (settingStore.theme === 'auto') {
|
||||
settingStore.theme = 'dark'
|
||||
} else {
|
||||
store.theme = store.theme === 'light' ? 'dark' : 'light'
|
||||
settingStore.theme = settingStore.theme === 'light' ? 'dark' : 'light'
|
||||
}
|
||||
document.documentElement.setAttribute('data-theme', store.theme)
|
||||
document.documentElement.setAttribute('data-theme', settingStore.theme)
|
||||
}
|
||||
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user