暗黑模式去除
This commit is contained in:
parent
e550642f0a
commit
d575852b50
|
|
@ -4,7 +4,6 @@ import Cookies from 'js-cookie'
|
||||||
|
|
||||||
import ElementPlus from 'element-plus'
|
import ElementPlus from 'element-plus'
|
||||||
import 'element-plus/dist/index.css'
|
import 'element-plus/dist/index.css'
|
||||||
import 'element-plus/theme-chalk/dark/css-vars.css'
|
|
||||||
import locale from 'element-plus/es/locale/lang/zh-cn'
|
import locale from 'element-plus/es/locale/lang/zh-cn'
|
||||||
|
|
||||||
import '@/assets/styles/index.scss' // global css
|
import '@/assets/styles/index.scss' // global css
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,6 @@
|
||||||
import defaultSettings from '@/settings'
|
import defaultSettings from '@/settings'
|
||||||
import { useDark, useToggle } from '@vueuse/core'
|
|
||||||
import { useDynamicTitle } from '@/utils/dynamicTitle'
|
import { useDynamicTitle } from '@/utils/dynamicTitle'
|
||||||
|
|
||||||
const isDark = useDark()
|
|
||||||
const toggleDark = useToggle(isDark)
|
|
||||||
|
|
||||||
const { sideTheme, showSettings, topNav, tagsView, fixedHeader, sidebarLogo, dynamicTitle } = defaultSettings
|
const { sideTheme, showSettings, topNav, tagsView, fixedHeader, sidebarLogo, dynamicTitle } = defaultSettings
|
||||||
|
|
||||||
const storageSetting = JSON.parse(localStorage.getItem('layout-setting')) || ''
|
const storageSetting = JSON.parse(localStorage.getItem('layout-setting')) || ''
|
||||||
|
|
@ -22,7 +18,8 @@ const useSettingsStore = defineStore(
|
||||||
fixedHeader: storageSetting.fixedHeader === undefined ? fixedHeader : storageSetting.fixedHeader,
|
fixedHeader: storageSetting.fixedHeader === undefined ? fixedHeader : storageSetting.fixedHeader,
|
||||||
sidebarLogo: storageSetting.sidebarLogo === undefined ? sidebarLogo : storageSetting.sidebarLogo,
|
sidebarLogo: storageSetting.sidebarLogo === undefined ? sidebarLogo : storageSetting.sidebarLogo,
|
||||||
dynamicTitle: storageSetting.dynamicTitle === undefined ? dynamicTitle : storageSetting.dynamicTitle,
|
dynamicTitle: storageSetting.dynamicTitle === undefined ? dynamicTitle : storageSetting.dynamicTitle,
|
||||||
isDark: isDark.value
|
// 关闭跟随系统的暗黑模式,默认使用亮色模式
|
||||||
|
isDark: false
|
||||||
}),
|
}),
|
||||||
actions: {
|
actions: {
|
||||||
// 修改布局设置
|
// 修改布局设置
|
||||||
|
|
@ -39,8 +36,8 @@ const useSettingsStore = defineStore(
|
||||||
},
|
},
|
||||||
// 切换暗黑模式
|
// 切换暗黑模式
|
||||||
toggleTheme() {
|
toggleTheme() {
|
||||||
|
// 如果后续仍需保留“主题模式”按钮,仅切换内部标记,不再操作系统/HTML 的暗黑类名
|
||||||
this.isDark = !this.isDark
|
this.isDark = !this.isDark
|
||||||
toggleDark()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue