diff --git a/src/components/TheSidebar.vue b/src/components/TheSidebar.vue index 6ef976a..3ca515b 100644 --- a/src/components/TheSidebar.vue +++ b/src/components/TheSidebar.vue @@ -70,17 +70,9 @@ export default { return this.pageSettings.find((el) => el.id === "settings"); }, }, - mounted() { - let href = window.location.href.slice(22); - this.pageSettings.forEach((el, index) => { - el.path === href.substr(href.lastIndexOf("#")) - ? (this.pageSettings[index].active = true) - : (this.pageSettings[index].active = false); - }); - }, watch: { - "$route.path"() { - if (this.$router.currentRoute._value.fullPath === "/calendar") { + "$route.path"(value) { + if (value === "/calendar") { this.currentPageBorder = true; this.pageSettings.forEach((el) => el.path === "#/calendar" ? (el.active = true) : (el.active = false) @@ -88,6 +80,13 @@ export default { } else this.currentPageBorder = false; }, }, + mounted() { + this.pageSettings.forEach((el, index) => { + el.path === "#" + this.$route.path + ? (this.pageSettings[index].active = true) + : (this.pageSettings[index].active = false); + }); + }, };