From 6050db3c797333019c2bfd4f4f4fb3d5aef9f34b Mon Sep 17 00:00:00 2001 From: Faris Ansari Date: Fri, 8 Nov 2019 16:15:40 +0530 Subject: [PATCH] fix: Sidebar activeGroup --- src/components/Sidebar.vue | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/components/Sidebar.vue b/src/components/Sidebar.vue index db307128..c3b2b012 100644 --- a/src/components/Sidebar.vue +++ b/src/components/Sidebar.vue @@ -66,7 +66,19 @@ export default { async mounted() { this.companyName = await sidebarConfig.getTitle(); this.groups = sidebarConfig.groups; - this.activeGroup = this.groups.find(g => g.title === _('Sales')); + + let currentPath = this.$router.currentRoute.fullPath; + this.activeGroup = this.groups.find(g => { + if (g.items) { + let activeItem = g.items.filter(i => i.route === currentPath); + if (activeItem.length) { + return true; + } + } + }); + if (!this.activeGroup) { + this.activeGroup = this.groups[0]; + } }, methods: { itemActiveClass(item) {