fix: 修复浏览器前进、后退时顶部菜单高亮不对的问题

This commit is contained in:
陈劲松
2020-02-25 18:08:03 +08:00
parent 76706e2f8e
commit 16771a49bd

View File

@@ -435,7 +435,12 @@
},
dialogClosed:function(){
this.showChangePwd=false;
}
},
cancel: function() {
this.activeIndex = this.$route.path.slice(1, this.$route.path.length);
console.info(this.activeIndex)
//this.$router.go(-1);
},
},
created() {
/*if (!localStorage.getItem("nz-language")) {
@@ -457,10 +462,16 @@
bus.$on('login', () => {
this.username = sessionStorage.getItem("nz-username");
this.refreshLang();
this.activeIndex = 'panel';
/*this.$nextTick(function(){
window.location.reload();
});*/
});
if (window.history && window.history.pushState) {
history.pushState(null, null, document.URL);
window.addEventListener('popstate', this.cancel, false);
}
},
computed: {
projectListReloadWatch() {
@@ -492,6 +503,9 @@
projectListReloadWatch(n, o) {
this.getProjectList();
}
},
destroyed() {
window.removeEventListener('popstate', this.cancel, false);
}
}
</script>