浏览代码

fix: fix some route problem

xiaoxian521 4 年之前
父节点
当前提交
b79ddfcfbd

+ 0 - 1
src/components/BreadCrumb/src/BreadCrumb.vue

@@ -84,7 +84,6 @@ export default defineComponent({
   display: inline-block;
   font-size: 14px;
   line-height: 50px;
-  margin-left: 8px;
 
   .no-redirect {
     color: #97a8be;

+ 15 - 7
src/layout/components/Navbar.vue

@@ -10,9 +10,14 @@
 
     <div class="right-menu">
       <!-- 全屏 -->
-      <screenfull />
+      <screenfull v-show="!deviceDetection()" />
       <!-- 国际化 -->
-      <div class="inter" :title="langs ? '中文' : 'English'" @click="toggleLang">
+      <div
+        v-show="!deviceDetection()"
+        class="inter"
+        :title="langs ? '中文' : 'English'"
+        @click="toggleLang"
+      >
         <img :src="langs ? ch : en" />
       </div>
       <i class="el-icon-setting hsset" :title="$t('message.hssystemSet')" @click="onPanel"></i>
@@ -49,6 +54,7 @@ import ch from "/@/assets/ch.png";
 import en from "/@/assets/en.png";
 import favicon from "/favicon.ico";
 import { emitter } from "/@/utils/mitt";
+import { deviceDetection } from "/@/utils/deviceDetection";
 
 export default defineComponent({
   name: "Navbar",
@@ -105,7 +111,8 @@ export default defineComponent({
       ch,
       en,
       favicon,
-      onPanel
+      onPanel,
+      deviceDetection
     };
   }
 });
@@ -113,9 +120,9 @@ export default defineComponent({
 
 <style lang="scss" scoped>
 .navbar {
+  width: 100%;
   height: 50px;
   overflow: hidden;
-  position: relative;
   background: #fff;
   box-shadow: 0 1px 4px rgba(0, 21, 41, 0.08);
 
@@ -137,16 +144,18 @@ export default defineComponent({
   }
 
   .right-menu {
-    float: right;
+    position: absolute;
+    right: 0;
     display: flex;
     align-items: center;
+    height: 48px;
+    line-height: 48px;
     .inter {
       width: 40px;
       height: 48px;
       display: flex;
       align-items: center;
       justify-content: space-around;
-      margin-right: 5px;
       &:hover {
         cursor: pointer;
         background: #f0f0f0;
@@ -169,7 +178,6 @@ export default defineComponent({
     }
     .el-dropdown-link {
       width: 80px;
-      height: 48px;
       display: flex;
       align-items: center;
       justify-content: space-around;

+ 13 - 15
src/layout/components/tag/index.vue

@@ -1,6 +1,6 @@
 <template>
   <div ref="containerDom" class="tags-view" v-if="!showTags">
-    <el-scrollbar :vertical="false" class="scroll-container">
+    <el-scrollbar wrap-class="scrollbar-wrapper" class="scroll-container">
       <div
         v-for="(item, index) in dynamicTagList"
         :key="index"
@@ -39,7 +39,7 @@
       </div>
     </ul>
     <!-- 右侧功能按钮 -->
-    <ul class="right-func">
+    <ul class="right-button">
       <li>
         <i
           :title="$t('message.hsrefreshRoute')"
@@ -327,7 +327,7 @@ export default {
     });
 
     return {
-      dynamicTagList: dRoutes,
+      dynamicTagList: useDynamicRoutesHook().dRoutes,
       deleteMenu,
       showTags,
       onFresh,
@@ -352,9 +352,9 @@ export default {
 <style lang="scss" scoped>
 .tags-view {
   width: 100%;
-  height: 40px;
   font-size: 14px;
   display: flex;
+  box-shadow: 0 0 1px #888888;
   .scroll-item {
     border-radius: 3px 3px 0 0;
     padding: 2px 8px;
@@ -374,18 +374,22 @@ export default {
   }
 
   .scroll-container {
-    text-align: left;
     padding: 5px 0;
     white-space: nowrap;
     position: relative;
     width: 100%;
     background: #fff;
-    border: 0.5px solid rgba($color: #ccc, $alpha: 0.3);
     .scroll-item {
       &:nth-child(1) {
         margin-left: 5px;
       }
     }
+
+    .scrollbar-wrapper {
+      position: absolute;
+      height: 40px;
+      overflow-x: hidden !important;
+    }
   }
 
   .contextmenu {
@@ -399,7 +403,6 @@ export default {
     font-size: 12px;
     font-weight: 400;
     color: #333;
-    box-shadow: 2px 2px 3px 0 rgba(0, 0, 0, 0.3);
     li {
       margin: 0;
       padding: 7px 16px;
@@ -411,20 +414,15 @@ export default {
   }
 }
 
-:deep(.el-scrollbar__wrap) {
-  height: 100vh;
-}
-
-.right-func {
+.right-button {
   display: flex;
   align-items: center;
   background: #fff;
-  border: 0.5px solid rgba($color: #ccc, $alpha: 0.3);
   font-size: 16px;
   li {
     width: 40px;
-    height: 34px;
-    line-height: 34px;
+    height: 38px;
+    line-height: 38px;
     text-align: center;
     border-right: 1px solid #ccc;
     cursor: pointer;

+ 6 - 4
src/layout/components/tag/tagsHook.ts

@@ -59,10 +59,12 @@ export function useDynamicRoutesHook() {
     if (route) {
       let ramStorage = storageLocal.getItem("routesInStorage");
       nextTick(() => {
-        let currentIndex = ramStorage.findIndex((v) => v.path === route.path);
-        if (currentIndex !== -1) return;
-        ramStorage.push({ path: route.path, meta: route.meta });
-        storageLocal.setItem("routesInStorage", ramStorage);
+        if (ramStorage) {
+          let currentIndex = ramStorage.findIndex((v) => v.path === route.path);
+          if (currentIndex !== -1) return;
+          ramStorage.push({ path: route.path, meta: route.meta });
+          storageLocal.setItem("routesInStorage", ramStorage);
+        }
       });
     }
 

+ 0 - 5
src/style/index.scss

@@ -78,11 +78,6 @@ ul {
   padding: 20px;
 }
 
-// 隐藏滚动条
-// .element::-webkit-scrollbar { width: 0 !important } //webkit
-// .element { -ms-overflow-style: none; } //IE 10+
-// .element { overflow: -moz-scrollbars-none; } //Firefox
-
 .login,
 .register {
   width: 100%;