Quellcode durchsuchen

修复移动端左侧菜单无法显示问题

RuoYi vor 1 Jahr
Ursprung
Commit
0780d9659b
1 geänderte Dateien mit 4 neuen und 1 gelöschten Zeilen
  1. 4 1
      src/layout/index.vue

+ 4 - 1
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 })