2
0
mirror of https://github.com/frappe/books.git synced 2024-11-10 07:40:55 +00:00

active item class

This commit is contained in:
Faris Ansari 2018-06-04 14:57:27 +05:30
parent 7eee7cd24f
commit 57c0b21ed9

View File

@ -13,7 +13,7 @@
<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-primary' : 'text-dark']"
:class="['nav-link', isActive(item) ? 'text-light bg-secondary' : 'text-dark']"
>
{{ item.label }}
</a>
@ -58,7 +58,11 @@ export default {
},
methods: {
isActive(item) {
return this.$route.path === item.route.slice(1);
if (this.$route.params.doctype) {
return this.$route.params.doctype === item.label;
}
const route = item.route.slice(1);
return this.$route.params.doctype === route;
}
}
}