From 002bbdec8ff37d32e760fd244f999b1cc452c388 Mon Sep 17 00:00:00 2001 From: pany <939630029@qq.com> Date: Sun, 21 May 2023 10:47:42 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E4=BB=A3=E7=A0=81=E4=BC=98=E5=8C=96=20?= =?UTF-8?q?=E6=89=80=E6=9C=89=E7=9A=84=20enum=20=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=E5=91=BD=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/layout/hooks/useResize.ts | 8 ++++---- src/layout/index.vue | 4 ++-- src/store/modules/app.ts | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/layout/hooks/useResize.ts b/src/layout/hooks/useResize.ts index c1dc55b..1cb7611 100644 --- a/src/layout/hooks/useResize.ts +++ b/src/layout/hooks/useResize.ts @@ -1,6 +1,6 @@ import { watch, onBeforeMount, onMounted, onBeforeUnmount } from "vue" import { useRoute } from "vue-router" -import { useAppStore, DeviceType } from "@/store/modules/app" +import { useAppStore, DeviceEnum } from "@/store/modules/app" /** 参考 Bootstrap 的响应式设计 WIDTH = 992 */ const WIDTH = 992 @@ -18,7 +18,7 @@ export default () => { const _resizeHandler = () => { if (!document.hidden) { const isMobile = _isMobile() - appStore.toggleDevice(isMobile ? DeviceType.Mobile : DeviceType.Desktop) + appStore.toggleDevice(isMobile ? DeviceEnum.Mobile : DeviceEnum.Desktop) if (isMobile) { appStore.closeSidebar(true) } @@ -28,7 +28,7 @@ export default () => { watch( () => route.name, () => { - if (appStore.device === DeviceType.Mobile && appStore.sidebar.opened) { + if (appStore.device === DeviceEnum.Mobile && appStore.sidebar.opened) { appStore.closeSidebar(false) } } @@ -40,7 +40,7 @@ export default () => { onMounted(() => { if (_isMobile()) { - appStore.toggleDevice(DeviceType.Mobile) + appStore.toggleDevice(DeviceEnum.Mobile) appStore.closeSidebar(true) } }) diff --git a/src/layout/index.vue b/src/layout/index.vue index e95bcdb..605df28 100644 --- a/src/layout/index.vue +++ b/src/layout/index.vue @@ -1,6 +1,6 @@