From 3c38598df86e697268b14865e68159d6ba989285 Mon Sep 17 00:00:00 2001
From: 819527061@qq.com <123456>
Date: 星期四, 11 四月 2024 15:32:04 +0800
Subject: [PATCH] docs: 首次加载白屏添加loading
---
src/components/common/Sidebar.vue | 122 +++++-----------------------------------
1 files changed, 17 insertions(+), 105 deletions(-)
diff --git a/src/components/common/Sidebar.vue b/src/components/common/Sidebar.vue
index 17ede75..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,112 +43,18 @@
<script>
import bus from '../common/bus';
+ import {mapState} from 'vuex';
export default {
data() {
return {
collapse: false,
- items: [
- {
- id:1,
- icon: 'el-icon-folder-opened',
- indexUrl: '1',
- name: '绯荤粺绠$悊',
- children:[
- {
- id:1,
- icon: 'el-icon-user-solid',
- name: '浜哄憳绠$悊',
- parentId: 1,
- indexUrl: 'user'
- }
- ]
- },
- {
- id:2,
- icon: 'el-icon-folder-opened',
- indexUrl: '2',
- name: '鏅烘収娉婅溅绠$悊',
- children:[
- {
- icon: 'el-icon-document',
- name: '鍋滆溅鍦虹鐞�',
- parentId: 2,
- indexUrl: "park"
- },
- {
- icon: 'el-icon-document',
- name: '鏀惰垂瑙勫垯绠$悊',
- parentId: 2,
- indexUrl: "costRule"
- },
- {
- icon: 'el-icon-document',
- name: '杞﹁締鍏ュ満绠$悊',
- parentId: 2,
- indexUrl: "enterPark"
- },
- {
- icon: 'el-icon-document',
- name: '杞﹁締鍑哄満绠$悊',
- parentId: 2,
- indexUrl: "outPark"
- },
- {
- icon: 'el-icon-document',
- name: '鐧藉悕鍗曠鐞�',
- parentId: 2,
- indexUrl: "whiteList"
- },
- {
- icon: 'el-icon-document',
- name: '娉婅溅鍙戠エ绠$悊',
- parentId: 2,
- indexUrl: "parkticket"
- },
- {
- icon: 'el-icon-document',
- name: '璁㈠崟缁熻',
- parentId: 2,
- indexUrl: "orderRecord"
- },
- ]
- },
- {
- id:3,
- icon: 'el-icon-folder-opened',
- indexUrl: '3',
- name: '鏅烘収缃氭病绠$悊',
- children:[
- {
- icon: 'el-icon-document',
- name: '杩濈珷绫诲瀷绠$悊',
- parentId: 3,
- indexUrl: "violationType"
- },
- {
- icon: 'el-icon-document',
- name: '琛楅亾绠$悊',
- parentId: 3,
- indexUrl: "street"
- },
- {
- icon: 'el-icon-document',
- name: '缃氬崟绠$悊',
- parentId: 3,
- indexUrl: "ticket"
- },
- {
- icon: 'el-icon-document',
- name: '缃氭病鍙戠エ绠$悊',
- parentId: 3,
- indexUrl: "zfticket"
- },
- ]
- },
- ]
+
}
},
computed:{
+ ...mapState({
+ items:'resultAsyncRoutes'
+ }),
onRoutes(){
return this.$route.path.replace('/','');
}
@@ -158,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