feat: 添加消息通知图标隐藏功能

This commit is contained in:
pany 2022-10-31 15:35:51 +08:00
parent d8f47cf91e
commit 4e2ffa38f5
4 changed files with 13 additions and 2 deletions

View File

@ -8,6 +8,8 @@ interface ILayoutSettings {
showSidebarLogo: boolean showSidebarLogo: boolean
/** 是否固定 Header */ /** 是否固定 Header */
fixedHeader: boolean fixedHeader: boolean
/** 是否显示消息通知 */
showNotify: boolean
/** 是否显示切换主题按钮 */ /** 是否显示切换主题按钮 */
showThemeSwitch: boolean showThemeSwitch: boolean
/** 是否显示全屏按钮 */ /** 是否显示全屏按钮 */
@ -19,6 +21,7 @@ const layoutSettings: ILayoutSettings = {
showTagsView: true, showTagsView: true,
fixedHeader: true, fixedHeader: true,
showSidebarLogo: true, showSidebarLogo: true,
showNotify: true,
showThemeSwitch: true, showThemeSwitch: true,
showScreenfull: true showScreenfull: true
} }

View File

@ -19,6 +19,9 @@ const userStore = useUserStore()
const sidebar = computed(() => { const sidebar = computed(() => {
return appStore.sidebar return appStore.sidebar
}) })
const showNotify = computed(() => {
return settingsStore.showNotify
})
const showThemeSwitch = computed(() => { const showThemeSwitch = computed(() => {
return settingsStore.showThemeSwitch return settingsStore.showThemeSwitch
}) })
@ -42,7 +45,7 @@ const logout = () => {
<div class="right-menu"> <div class="right-menu">
<Screenfull v-if="showScreenfull" class="right-menu-item" /> <Screenfull v-if="showScreenfull" class="right-menu-item" />
<ThemeSwitch v-if="showThemeSwitch" class="right-menu-item" /> <ThemeSwitch v-if="showThemeSwitch" class="right-menu-item" />
<Notify class="right-menu-item" /> <Notify v-if="showNotify" class="right-menu-item" />
<el-dropdown class="right-menu-item"> <el-dropdown class="right-menu-item">
<el-avatar :icon="UserFilled" :size="34" /> <el-avatar :icon="UserFilled" :size="34" />
<template #dropdown> <template #dropdown>

View File

@ -20,6 +20,10 @@ const settingsStore = useSettingsStore()
<span>固定 Header</span> <span>固定 Header</span>
<el-switch v-model="settingsStore.fixedHeader" class="drawer-switch" /> <el-switch v-model="settingsStore.fixedHeader" class="drawer-switch" />
</div> </div>
<div class="drawer-item">
<span>显示消息通知</span>
<el-switch v-model="settingsStore.showNotify" class="drawer-switch" />
</div>
<div class="drawer-item"> <div class="drawer-item">
<span>显示切换主题按钮</span> <span>显示切换主题按钮</span>
<el-switch v-model="settingsStore.showThemeSwitch" class="drawer-switch" /> <el-switch v-model="settingsStore.showThemeSwitch" class="drawer-switch" />

View File

@ -7,8 +7,9 @@ export const useSettingsStore = defineStore("settings", () => {
const showSettings = ref<boolean>(layoutSettings.showSettings) const showSettings = ref<boolean>(layoutSettings.showSettings)
const showTagsView = ref<boolean>(layoutSettings.showTagsView) const showTagsView = ref<boolean>(layoutSettings.showTagsView)
const showSidebarLogo = ref<boolean>(layoutSettings.showSidebarLogo) const showSidebarLogo = ref<boolean>(layoutSettings.showSidebarLogo)
const showNotify = ref<boolean>(layoutSettings.showNotify)
const showThemeSwitch = ref<boolean>(layoutSettings.showThemeSwitch) const showThemeSwitch = ref<boolean>(layoutSettings.showThemeSwitch)
const showScreenfull = ref<boolean>(layoutSettings.showScreenfull) const showScreenfull = ref<boolean>(layoutSettings.showScreenfull)
return { fixedHeader, showSettings, showTagsView, showSidebarLogo, showThemeSwitch, showScreenfull } return { fixedHeader, showSettings, showTagsView, showSidebarLogo, showNotify, showThemeSwitch, showScreenfull }
}) })