perf: 代码优化 components/ThemeSwitch
This commit is contained in:
parent
d22a44396d
commit
8a24b6d219
@ -1,16 +1,12 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { type ThemeName, useTheme } from "@/hooks/useTheme"
|
import { useTheme } from "@/hooks/useTheme"
|
||||||
import { MagicStick } from "@element-plus/icons-vue"
|
import { MagicStick } from "@element-plus/icons-vue"
|
||||||
|
|
||||||
const { themeList, activeThemeName, setTheme } = useTheme()
|
const { themeList, activeThemeName, setTheme } = useTheme()
|
||||||
|
|
||||||
const handleSetTheme = (name: ThemeName) => {
|
|
||||||
setTheme(name)
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<el-dropdown trigger="click" @command="handleSetTheme">
|
<el-dropdown trigger="click" @command="setTheme">
|
||||||
<div>
|
<div>
|
||||||
<el-tooltip effect="dark" content="主题模式" placement="bottom">
|
<el-tooltip effect="dark" content="主题模式" placement="bottom">
|
||||||
<el-icon :size="20">
|
<el-icon :size="20">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user