jichoi / lms_front star
woals 08-13
240813 권민수 홈 경로 진입 시 모든 메뉴 버튼 비활성화 로직 추가
@de44dd5d735d554640d9a49f91f3bce795afcaaa
client/views/layout/Menu.vue
--- client/views/layout/Menu.vue
+++ client/views/layout/Menu.vue
@@ -22,17 +22,38 @@
   
   
   export default {
+    props: {
+      currentRoute: {
+        type: String,
+        required: true
+      }
+    },
     data() {
       return {
         activeButton: '',
       };
     },
     methods: {
+
       goToApp(button) {
         this.activeButton = button;
       },
+
+      // 홈 화면이면 모든 버튼을 비활성화
+      updateActiveButton() {
+        if (this.currentRoute === '/') {
+          this.activeButton = '';
+        }
+      }
+
+    },
+    watch: {
+      currentRoute() {
+        this.updateActiveButton();
+      }
     },
     mounted() {
+      this.updateActiveButton();
       console.log('Menu mounted');
     }
   };
client/views/pages/main/Main.vue
--- client/views/pages/main/Main.vue
+++ client/views/pages/main/Main.vue
@@ -4,7 +4,7 @@
           <div class="flex justify-between" >
              <Side></Side>
              <div>
-                <Menu></Menu>
+                <Menu :currentRoute="$route.path"></Menu>
                 <div class="main-wrap">
                     <router-view />
                 </div>
package-lock.json
--- package-lock.json
+++ package-lock.json
@@ -1,5 +1,5 @@
 {
-  "name": "lms_front-1",
+  "name": "lms_front",
   "lockfileVersion": 3,
   "requires": true,
   "packages": {
Add a comment
List