2
0
mirror of https://github.com/frappe/books.git synced 2024-11-10 15:50:56 +00:00
books/ui/components/Sidebar.vue
2018-06-27 20:08:27 +05:30

48 lines
1.2 KiB
Vue

<template>
<div class="frappe-sidebar col-2 bg-light border-right">
<div class="navbar border-bottom">
<div class="navbar-text">
TennisMart
</div>
</div>
<div class="my-3" v-for="(sidebarGroup, index) in sidebarConfig" :key="index">
<h6 v-if="sidebarGroup.title" class="sidebar-heading nav-link text-muted text-uppercase m-0">
{{ sidebarGroup.title }}
</h6>
<nav class="nav flex-column">
<li class="nav-item">
<a v-for="item in sidebarGroup.items" :key="item.route"
:href="item.route"
:class="['nav-link', isActive(item) ? 'text-light bg-secondary' : 'text-dark']" >
{{ item.label }}
</a>
</li>
</nav>
</div>
</div>
</template>
<script>
export default {
props: ['sidebarConfig'],
methods: {
isActive(item) {
if (this.$route.params.doctype) {
return this.$route.params.doctype === item.label;
}
const route = item.route.slice(1);
return this.$route.path === route;
}
}
}
</script>
<style>
.frappe-sidebar {
min-height: calc(100vh);
}
.sidebar-heading {
font-size: 0.8rem;
}
</style>