forked from dongweiming/wechat-admin
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.vue
More file actions
99 lines (96 loc) · 1.93 KB
/
Main.vue
File metadata and controls
99 lines (96 loc) · 1.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
<template>
<div class="nav">
<div v-for="item in items">
<div class="item">
<h2>{{ item.title }}</h2>
<ul>
<li v-for="sub_item in item.sub_items">
<router-link :to="{ path: sub_item.path }">{{ sub_item.name }}</router-link>
</li>
</ul>
</div>
</div>
</div>
</template>
<script>
export default {
data() {
return {
items: []
}
},
mounted() {
this.$router.options.routes.forEach(route => {
if (!route.hidden && !route.leaf) {
let sub_items = [];
route.children.forEach(sub_route => {
if (!sub_route.hidden) {
sub_items.push({
name: sub_route.name,
path: sub_route.path
});
}
});
this.items.push({
title: route.name,
sub_items: sub_items
});
}
})
}
}
</script>
<style lang="scss" scoped>
* {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
h2 {
width: 140px;
padding: 11px 15px;
margin: 0;
font-size: 18px;
font-weight: normal;
color: #fff;
background-color: #20a0ff;
}
.nav {
background-color: #f6f6f6;
padding: 20px;
}
.item {
overflow: hidden;
margin: 20px 0 30px;
ul {
margin-right: -1%;
padding: 0;
}
li {
float: left;
width: 19%;
margin-right: 1%;
margin-top: 1%;
padding: 15px;
font-size: 12px;
height: 89px;
overflow: hidden;
background-color: #fff;
border-bottom: 15px solid #fff;
a {
margin-bottom: 5px;
display: inline-block;
font-size: 14px;
font-weight: bold;
color: #45B6F7;
border-bottom: 2px solid transparent;
text-decoration: inherit;
cursor: pointer;
&:hover, &:active {
color: #FD8C84;
border-bottom-color: #FD8C84;
}
}
}
}
</style>