perf: 代码优化 layout/NavigationBar

This commit is contained in:
pany 2023-06-14 18:14:11 +08:00
parent 710ff1cda7
commit 9083700b3d

View File

@ -1,6 +1,6 @@
<script lang="ts" setup> <script lang="ts" setup>
import { computed } from "vue"
import { useRouter } from "vue-router" import { useRouter } from "vue-router"
import { storeToRefs } from "pinia"
import { useAppStore } from "@/store/modules/app" import { useAppStore } from "@/store/modules/app"
import { useSettingsStore } from "@/store/modules/settings" import { useSettingsStore } from "@/store/modules/settings"
import { useUserStore } from "@/store/modules/user" import { useUserStore } from "@/store/modules/user"
@ -16,22 +16,14 @@ const appStore = useAppStore()
const settingsStore = useSettingsStore() const settingsStore = useSettingsStore()
const userStore = useUserStore() const userStore = useUserStore()
const sidebar = computed(() => { const { sidebar } = storeToRefs(appStore)
return appStore.sidebar const { showNotify, showThemeSwitch, showScreenfull } = storeToRefs(settingsStore)
})
const showNotify = computed(() => {
return settingsStore.showNotify
})
const showThemeSwitch = computed(() => {
return settingsStore.showThemeSwitch
})
const showScreenfull = computed(() => {
return settingsStore.showScreenfull
})
/** 切换侧边栏 */
const toggleSidebar = () => { const toggleSidebar = () => {
appStore.toggleSidebar(false) appStore.toggleSidebar(false)
} }
/** 登出 */
const logout = () => { const logout = () => {
userStore.logout() userStore.logout()
router.push("/login") router.push("/login")
@ -87,7 +79,7 @@ const logout = () => {
} }
.breadcrumb { .breadcrumb {
float: left; float: left;
// Bootstrap WIDTH = 576 // Bootstrap 576
@media screen and (max-width: 576px) { @media screen and (max-width: 576px) {
display: none; display: none;
} }