forked from ElemeFE/v-charts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsidebar.vue
90 lines (79 loc) · 1.76 KB
/
sidebar.vue
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
<template>
<div class="component-sidebar">
<div
class="main-section"
v-for="(menu, title) in menus"
:key="title">
<span class="main-title">{{ title }}</span>
<ul class="sidebar-ul">
<li class="sidebar-li" v-for="(item, index) in menu" :key="index">
<router-link exact :to="item.url">{{ item.name }}</router-link>
</li>
</ul>
</div>
</div>
</template>
<script>
import chartData from '../data/index'
import { TEST_ROUTES } from '../router'
const routerInfo = {
'图表': Object.keys(chartData).map(key => {
return {
name: chartData[key].name,
url: `/chart/${chartData[key].type}`
}
}),
'其他': [
{ name: '百度地图', url: '/bmap' },
{ name: '高德地图', url: '/amap' }
],
'测试示例': TEST_ROUTES.map(({ name, path }) => ({ name, url: path }))
}
export default {
name: 'Sidebar',
created () {
this.menus = routerInfo
}
}
</script>
<style lang="less">
.component-sidebar {
height: 100%;
.main-section {
padding-left: 20px;
padding-top: 35px;
color: #5e6d82;
.main-title {
display: inline-block;
width: 100px;
font-size: 16px;
padding-bottom: 10px;
padding-left: 10px;
border-bottom: 1px solid #e8e8e8;
}
ul {
padding: 10px 0 0;
margin: 0;
padding-left: 20px;
font-size: 14px;
li {
list-style: none;
height: 30px;
line-height: 30px;
a {
text-decoration: none;
display: inline-block;
width: 100%;
height: 100%;
color: inherit;
font-weight: lighter;
&:hover,
&.router-link-active {
color: #19d4ae;
}
}
}
}
}
}
</style>