diff options
| author | pany <[email protected]> | 2023-06-14 18:14:11 +0800 |
|---|---|---|
| committer | pany <[email protected]> | 2023-06-14 18:14:11 +0800 |
| commit | 9083700b3def9c31e6a7207f40b42e94b119696e (patch) | |
| tree | fbda72a4eb9a12b51950b52b53488ca98a22ffb3 /src | |
| parent | 710ff1cda78f27741529f3ae98b4cf20378be52b (diff) | |
perf: 代码优化 layout/NavigationBar
Diffstat (limited to 'src')
| -rw-r--r-- | src/layout/components/NavigationBar/index.vue | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/src/layout/components/NavigationBar/index.vue b/src/layout/components/NavigationBar/index.vue index a630ac1..87ac6ae 100644 --- a/src/layout/components/NavigationBar/index.vue +++ b/src/layout/components/NavigationBar/index.vue @@ -1,6 +1,6 @@ <script lang="ts" setup> -import { computed } from "vue" import { useRouter } from "vue-router" +import { storeToRefs } from "pinia" import { useAppStore } from "@/store/modules/app" import { useSettingsStore } from "@/store/modules/settings" import { useUserStore } from "@/store/modules/user" @@ -16,22 +16,14 @@ const appStore = useAppStore() const settingsStore = useSettingsStore() const userStore = useUserStore() -const sidebar = computed(() => { - return appStore.sidebar -}) -const showNotify = computed(() => { - return settingsStore.showNotify -}) -const showThemeSwitch = computed(() => { - return settingsStore.showThemeSwitch -}) -const showScreenfull = computed(() => { - return settingsStore.showScreenfull -}) +const { sidebar } = storeToRefs(appStore) +const { showNotify, showThemeSwitch, showScreenfull } = storeToRefs(settingsStore) +/** 切换侧边栏 */ const toggleSidebar = () => { appStore.toggleSidebar(false) } +/** 登出 */ const logout = () => { userStore.logout() router.push("/login") @@ -87,7 +79,7 @@ const logout = () => { } .breadcrumb { float: left; - // 参考 Bootstrap 的响应式设计 WIDTH = 576 + // 参考 Bootstrap 的响应式设计将宽度设置为 576 @media screen and (max-width: 576px) { display: none; } |
