From c65536ee6fbda877e9476e7421d851900e6a76b6 Mon Sep 17 00:00:00 2001
From: 疯狂的狮子li <15040126243@163.com>
Date: 星期四, 06 四月 2023 11:19:31 +0800
Subject: [PATCH] update 优化弹窗后导航栏偏移的问题(I3YMWW)

---
 src/layout/index.vue |   80 +++++++++++++++++++++++----------------
 1 files changed, 47 insertions(+), 33 deletions(-)

diff --git a/src/layout/index.vue b/src/layout/index.vue
index 673b0fd..4c6ab94 100644
--- a/src/layout/index.vue
+++ b/src/layout/index.vue
@@ -1,3 +1,20 @@
+<template>
+  <div :class="classObj" class="app-wrapper" :style="{ '--current-color': theme }">
+    <el-scrollbar>
+      <div v-if="device === 'mobile' && sidebar.opened" class="drawer-bg" @click="handleClickOutside"/>
+      <side-bar v-if="!sidebar.hide" class="sidebar-container" />
+      <div :class="{ hasTagsView: needTagsView, sidebarHide: sidebar.hide }" class="main-container">
+        <div :class="{ 'fixed-header': fixedHeader }">
+            <navbar ref="navbarRef" @setLayout="setLayout" />
+            <tags-view v-if="needTagsView" />
+        </div>
+        <app-main />
+        <settings ref="settingRef" />
+      </div>
+    </el-scrollbar>
+  </div>
+</template>
+
 <script setup lang="ts">
 import SideBar from './components/Sidebar/index.vue'
 import { AppMain, Navbar, Settings, TagsView } from './components'
@@ -12,59 +29,44 @@
 const fixedHeader = computed(() => settingsStore.fixedHeader);
 
 const classObj = computed(() => ({
-  hideSidebar: !sidebar.value.opened,
-  openSidebar: sidebar.value.opened,
-  withoutAnimation: sidebar.value.withoutAnimation,
-  mobile: device.value === 'mobile'
+    hideSidebar: !sidebar.value.opened,
+    openSidebar: sidebar.value.opened,
+    withoutAnimation: sidebar.value.withoutAnimation,
+    mobile: device.value === 'mobile'
 }))
 
 const { width } = useWindowSize();
 const WIDTH = 992; // refer to Bootstrap's responsive design
 
 watchEffect(() => {
-  if (device.value === 'mobile' && sidebar.value.opened) {
-    useAppStore().closeSideBar({ withoutAnimation: false })
-  }
-  if (width.value - 1 < WIDTH) {
-    useAppStore().toggleDevice('mobile')
-    useAppStore().closeSideBar({ withoutAnimation: true })
-  } else {
-    useAppStore().toggleDevice('desktop')
-  }
+    if (device.value === 'mobile' && sidebar.value.opened) {
+        useAppStore().closeSideBar({ withoutAnimation: false })
+    }
+    if (width.value - 1 < WIDTH) {
+        useAppStore().toggleDevice('mobile')
+        useAppStore().closeSideBar({ withoutAnimation: true })
+    } else {
+        useAppStore().toggleDevice('desktop')
+    }
 })
 
 const navbarRef = ref(Navbar);
 const settingRef = ref(Settings);
 
 onMounted(() => {
-  nextTick(() => {
-    navbarRef.value.initTenantList();
-  })
+    nextTick(() => {
+        navbarRef.value.initTenantList();
+    })
 })
 
 const handleClickOutside = () => {
-  useAppStore().closeSideBar({ withoutAnimation: false })
+    useAppStore().closeSideBar({ withoutAnimation: false })
 }
 
 const setLayout = () => {
-  settingRef.value.openSetting();
+    settingRef.value.openSetting();
 }
 </script>
-
-<template>
-	<div :class="classObj" class="app-wrapper" :style="{ '--current-color': theme }">
-		<div v-if="device === 'mobile' && sidebar.opened" class="drawer-bg" @click="handleClickOutside" />
-		<side-bar v-if="!sidebar.hide" class="sidebar-container" />
-		<div :class="{ hasTagsView: needTagsView, sidebarHide: sidebar.hide }" class="main-container">
-			<div :class="{ 'fixed-header': fixedHeader }">
-				<navbar ref="navbarRef" @setLayout="setLayout" />
-				<tags-view v-if="needTagsView" />
-			</div>
-			<app-main />
-			<settings ref="settingRef" />
-		</div>
-	</div>
-</template>
 
 <style lang="scss" scoped>
   @import "@/assets/styles/mixin.scss";
@@ -76,6 +78,18 @@
   height: 100%;
   width: 100%;
 
+  .el-scrollbar {
+    height: 100%;
+  }
+
+  :deep(.el-scrollbar__bar).is-vertical {
+    z-index: 10;
+  }
+
+  :deep(.el-scrollbar__wrap) {
+    overflow-x: hidden;
+  }
+
   &.mobile.openSidebar {
     position: fixed;
     top: 0;

--
Gitblit v1.9.3