element/examples/components/side-nav.vue

118 lines
2.5 KiB
Vue
Raw Normal View History

2016-08-23 06:03:45 +00:00
<style>
2016-08-23 09:39:58 +00:00
.side-nav {
width: 100%;
box-sizing: border-box;
2016-09-18 14:01:26 +00:00
padding-right: 30px;
2016-08-23 09:39:58 +00:00
li {
list-style: none;
}
ul {
padding: 0;
2016-08-23 11:15:15 +00:00
margin: 0;
2016-08-25 07:54:45 +00:00
overflow: hidden;
2016-08-23 09:39:58 +00:00
}
.nav-item {
a {
2016-09-13 12:02:33 +00:00
font-size: 16px;
color: #5e6d82;
line-height: 40px;
height: 40px;
2016-09-07 04:17:16 +00:00
margin: 0;
2016-09-13 12:02:33 +00:00
padding: 0;
2016-08-23 09:39:58 +00:00
text-decoration: none;
display: block;
2016-09-07 04:17:16 +00:00
position: relative;
transition: all .3s;
2016-08-23 09:39:58 +00:00
&.active {
color: #20a0ff;
}
}
.nav-item {
a {
2016-09-07 04:17:16 +00:00
display: block;
2016-09-13 12:02:33 +00:00
height: 40px;
line-height: 40px;
font-size: 13px;
padding-left: 24px;
2016-09-07 04:17:16 +00:00
2016-08-23 09:39:58 +00:00
&:hover {
2016-09-07 04:17:16 +00:00
color: #20a0ff;
2016-08-23 09:39:58 +00:00
}
}
}
}
.nav-group__title {
2016-09-13 12:02:33 +00:00
font-size: 12px;
2016-08-23 09:39:58 +00:00
color: #99a9bf;
2016-09-13 12:02:33 +00:00
padding-left: 8px;
line-height: 26px;
margin-top: 10px;
2016-08-23 09:39:58 +00:00
}
}
2016-08-23 06:03:45 +00:00
</style>
<template>
<div class="side-nav">
<ul>
2016-08-23 09:39:58 +00:00
<li class="nav-item" v-for="item in data">
2016-08-23 11:15:15 +00:00
<a v-if="!item.path">{{item.name}}</a>
<router-link
v-else
active-class="active"
:to="base + item.path"
exact
v-text="item.title || item.name">
</router-link>
2016-08-23 09:39:58 +00:00
<ul class="pure-menu-list sub-nav" v-if="item.children">
<li class="nav-item" v-for="navItem in item.children">
<router-link
class=""
active-class="active"
2016-08-23 11:15:15 +00:00
:to="base + navItem.path"
2016-08-23 09:39:58 +00:00
exact
2016-08-23 11:15:15 +00:00
v-text="navItem.title || navItem.name">
2016-08-23 09:39:58 +00:00
</router-link>
</li>
</ul>
<template v-if="item.groups">
<div class="nav-group" v-for="group in item.groups">
<div class="nav-group__title">{{group.groupName}}</div>
<ul class="pure-menu-list">
<li
class="nav-item"
2016-08-23 11:15:15 +00:00
v-for="navItem in group.list"
v-if="!navItem.disabled">
2016-08-23 09:39:58 +00:00
<router-link
active-class="active"
2016-08-23 11:15:15 +00:00
:to="base + navItem.path"
2016-08-23 09:39:58 +00:00
exact
2016-08-23 11:15:15 +00:00
v-text="navItem.title"></router-link>
2016-08-23 09:39:58 +00:00
</li>
</ul>
</div>
</template>
2016-08-23 06:03:45 +00:00
</li>
</ul>
</div>
</template>
<script>
export default {
props: {
2016-08-23 11:15:15 +00:00
data: Array,
base: {
type: String,
default: ''
}
2016-08-23 06:03:45 +00:00
},
data() {
return {
highlights: [],
navState: []
};
}
};
</script>