From 07d9dac587d5265fedd94a518c711721413f13b5 Mon Sep 17 00:00:00 2001
From: 819527061@qq.com <123456>
Date: 星期二, 09 四月 2024 17:41:26 +0800
Subject: [PATCH] docs:路由修改

---
 src/components/common/Sidebar.vue |   87 ++++++++-----------------------------------
 1 files changed, 17 insertions(+), 70 deletions(-)

diff --git a/src/components/common/Sidebar.vue b/src/components/common/Sidebar.vue
index 2a34483..ecf7436 100644
--- a/src/components/common/Sidebar.vue
+++ b/src/components/common/Sidebar.vue
@@ -1,14 +1,16 @@
 <template>
     <div class="sidebar">
         <el-menu class="sidebar-el-menu" :default-active="onRoutes" :collapse="collapse" background-color="#324157"
-            text-color="#bfcbd9" active-text-color="#20a0ff" unique-opened router>
+            text-color="#bfcbd9" active-text-color="#20a0ff" unique-opened router
+            >
             <template v-for="item in items">
                 <template v-if="item.children">
-                    <el-submenu :index="item.indexUrl" :key="item.indexUrl">
+                    <el-submenu :index="item.indexUrl" :key="item.indexUrl"
+                    >
                         <template slot="title">
                             <i :class="item.icon"></i><span slot="title">{{ item.name }}</span>
                         </template>
-                        <template v-for="subItem in item.children">
+                        <div v-for="subItem in item.children" :key="subItem.indexUrl">
                             <!--<el-submenu v-if="subItem.children" :index="subItem.indexUrl" :key="subItem.indexUrl">-->
                                 <!--<template slot="title">-->
                                     <!--<i :class="subItem.icon"></i><span slot="title">{{ subItem.name }}</span>-->
@@ -19,12 +21,12 @@
                                     <!--</template>-->
                                 <!--</el-menu-item>-->
                             <!--</el-submenu>-->
-                            <el-menu-item :index="subItem.indexUrl" :key="subItem.indexUrl">
+                            <el-menu-item :index="subItem.indexUrl">
                                 <template slot="title">
                                     <i :class="subItem.icon"></i><span slot="title">{{ subItem.name }}</span>
                                 </template>
                             </el-menu-item>
-                        </template>
+                        </div>
                     </el-submenu>
                 </template>
                 <template v-else>
@@ -41,77 +43,18 @@
 
 <script>
     import bus from '../common/bus';
+    import {mapState} from 'vuex';
     export default {
         data() {
             return {
                 collapse: false,
-                items: [
-                    {
-                        id:1,
-                        icon: 'el-icon-document',
-                        name: '浜哄憳绠$悊',
-                        indexUrl: 'user'
-                    },
-                    {
-                        id:2,
-                        icon: 'el-icon-document',
-                        name: '鍋滆溅鍦虹鐞�',
-                        indexUrl: 'park'
-                    },
-                    {
-                        id:3,
-                        icon: 'el-icon-document',
-                        name: '杩濈珷绫诲瀷绠$悊',
-                        indexUrl: 'violationType'
-                    },
-                    // {
-                    //     id:4,
-                    //     icon: 'el-icon-document',
-                    //     name: '璁㈠崟绠$悊',
-                    //     indexUrl: 'outPark'
-                    // },
-                    // {
-                    //     id:5,
-                    //     icon: 'el-icon-document',
-                    //     name: '缃氬崟绠$悊',
-                    //     indexUrl: 'ticket'
-                    // },
-                    {
-                        id:6,
-                        icon: 'el-icon-document',
-                        name: '鐧藉悕鍗�',
-                        indexUrl: 'whiteList'
-                    },
-                    {
-                        id:7,
-                        icon: 'el-icon-document',
-                        name: '琛楅亾绠$悊',
-                        indexUrl: 'street'
-                    },
-                    // {
-                    //     id:3,
-                    //     icon: 'el-icon-folder-opened',
-                    //     indexUrl: '2',
-                    //     name: '缁熻鎶ヨ〃',
-                    //     children:[
-                    //         {
-                    //             icon: 'el-icon-document',
-                    //             name: '鏅�氬憳宸ユ湀搴﹁瘎浠�',
-                    //             parentId: 3,
-                    //             indexUrl: "puTongYuanGongStatistic"
-                    //         },
-                    //         {
-                    //             icon: 'el-icon-document',
-                    //             name: '鑱岃兘閮ㄩ棬璇勪环缁撴灉',
-                    //             parentId: 3,
-                    //             indexUrl: "leaderStatistic"
-                    //         }
-                    //     ]
-                    // }
-                ]
+
             }
         },
         computed:{
+          ...mapState({
+             items:'resultAsyncRoutes'
+            }),
             onRoutes(){
                 return this.$route.path.replace('/','');
             }
@@ -123,11 +66,15 @@
             })
         },
         mounted(){
+            // type 2 : all
+            // type 0 :  娉婅溅 id:2
+            // type 1 :  鎵ф硶 id:3
             // var url = this.$systemconfig.basePath + '/menuList';
             // this.$byutil.postData(this,url,{},res=>{
             //     this.items = res.obj.menuList;
             // })
-        }
+        },
+
     }
 </script>
 

--
Gitblit v1.9.1