refactor: 将多主题功能从 pinia 抽离为 hook
This commit is contained in:
@@ -1,17 +1,12 @@
|
||||
<script lang="ts" setup>
|
||||
import { computed } from "vue"
|
||||
import { useAppStore } from "@/store/modules/app"
|
||||
import themeList from "@/config/theme"
|
||||
import type { ThemeName } from "@/config/theme"
|
||||
import { useTheme } from "@/hooks/useTheme"
|
||||
import type { ThemeName } from "@/hooks/useTheme"
|
||||
import { MagicStick } from "@element-plus/icons-vue"
|
||||
|
||||
const appStore = useAppStore()
|
||||
const { themeList, activeThemeName, setTheme } = useTheme()
|
||||
|
||||
const activeThemeName = computed(() => {
|
||||
return appStore.activeThemeName
|
||||
})
|
||||
const handleSetTheme = (name: ThemeName) => {
|
||||
appStore.setTheme(name)
|
||||
setTheme(name)
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user