2
0
mirror of https://github.com/frappe/books.git synced 2024-11-14 01:14:03 +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"> <li class="nav-item">
<a v-for="item in sidebarGroup.items" :key="item.route" <a v-for="item in sidebarGroup.items" :key="item.route"
:href="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 }} {{ item.label }}
</a> </a>
@ -58,7 +58,11 @@ export default {
}, },
methods: { methods: {
isActive(item) { 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;
} }
} }
} }