diff --git a/ruoyi-fastapi-frontend/src/layout/index.vue b/ruoyi-fastapi-frontend/src/layout/index.vue index 3ddb165..bad8dae 100644 --- a/ruoyi-fastapi-frontend/src/layout/index.vue +++ b/ruoyi-fastapi-frontend/src/layout/index.vue @@ -40,10 +40,13 @@ const classObj = computed(() => ({ const { width, height } = useWindowSize(); const WIDTH = 992; // refer to Bootstrap's responsive design -watchEffect(() => { +watch(() => device.value, () => { if (device.value === 'mobile' && sidebar.value.opened) { useAppStore().closeSideBar({ withoutAnimation: false }) } +}) + +watchEffect(() => { if (width.value - 1 < WIDTH) { useAppStore().toggleDevice('mobile') useAppStore().closeSideBar({ withoutAnimation: true })