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