Selaa lähdekoodia

Merge remote-tracking branch 'origin/master'

tianyabing 2 vuotta sitten
vanhempi
commit
44be6af864
1 muutettua tiedostoa jossa 39 lisäystä ja 23 poistoa
  1. 39 23
      src/views/HomeView.vue

+ 39 - 23
src/views/HomeView.vue

@@ -1,4 +1,3 @@
-
 <template>
   <div class="home">
     <a-layout id="components-layout-demo-top-side-2">
@@ -6,15 +5,23 @@
         <HomeHeader :leftVisible.sync="leftVisible" :is-login="true" />
       </a-layout-header>
       <a-layout class="main_body">
-        <a-drawer v-if="leftVisible"
-            placement="left"
-            :visible="leftVisible"
-            :get-container="false"
-            :closable="false"
-            @close="closeLeft"
-            width="auto"
-            :wrap-style="{ position: 'absolute' }">
-          <HomeLeft :close="()=>{leftVisible=false}" />
+        <a-drawer
+          v-if="leftVisible"
+          placement="left"
+          :visible="leftVisible"
+          :get-container="false"
+          :closable="false"
+          @close="closeLeft"
+          width="auto"
+          :wrap-style="{ position: 'absolute' }"
+        >
+          <HomeLeft
+            :close="
+              () => {
+                leftVisible = false;
+              }
+            "
+          />
         </a-drawer>
         <a-layout-sider
           v-model="collapse"
@@ -29,8 +36,16 @@
         <!-- 内容 -->
         <a-layout-content class="home-page">
           <Transition name="fade-transform" mode="out-in">
-            <router-view :key="$route.matched[1]?$route.matched[1].name?$route.matched[1].name:-1:-1" />
-          </transition>
+            <router-view
+              :key="
+                $route.matched[1]
+                  ? $route.matched[1].name
+                    ? $route.matched[1].name
+                    : -1
+                  : -1
+              "
+            />
+          </Transition>
         </a-layout-content>
       </a-layout>
     </a-layout>
@@ -63,29 +78,30 @@ export default {
   watch: {
     $route() {
       this.judgeHideAside();
-    }
+    },
   },
+
   mounted() {
     this.judgeHideAside();
-    if (this.$route.matched.length===1) {
-      this.$router.push({path: '/dashboard'})
+    if (this.$route.matched.length === 1) {
+      this.$router.push({ path: "/dashboard" });
     }
   },
   methods: {
     closeLeft() {
-      this.leftVisible = false
+      this.leftVisible = false;
     },
     judgeHideAside() {
-      let name = this.$route.name
+      let name = this.$route.name;
       if (!name) {
         this.asideWidth = 160;
         this.collapsedWidth = 60;
         return;
       }
-      if (['dashboard','notice'].indexOf(name)>-1) {
+      if (["dashboard", "notice"].indexOf(name) > -1) {
         this.asideWidth = 0;
-        this.collapsedWidth=0;
-      } else if (this.asideWidth===0) {
+        this.collapsedWidth = 0;
+      } else if (this.asideWidth === 0) {
         this.asideWidth = 160;
         this.collapsedWidth = 60;
       }
@@ -109,8 +125,8 @@ export default {
     padding: 0;
     line-height: 60px;
   }
-  .main_body{
-    height:calc(100vh - 60px);
+  .main_body {
+    height: calc(100vh - 60px);
     position: relative;
   }
 
@@ -123,6 +139,6 @@ export default {
   }
 }
 /deep/ .ant-drawer-content {
-  background: rgba(255, 255, 255,.85);
+  background: rgba(255, 255, 255, 0.85);
 }
 </style>