fixed:修改本地缓存菜单

guangyin
guangyin 2023-07-10 10:50:57 +08:00
parent 1def7b5d35
commit 780ae493ad
1 changed files with 7 additions and 7 deletions

View File

@ -54,8 +54,8 @@ export default class HeaderComponent extends Vue {
public timer;
public showPageList = false;
public pageList = pageListData;
public currentPage = JSON.parse(localStorage.getItem("currentPage") as any) || this.pageList[0];
public currentNav = localStorage.getItem("currentNav") || this.currentPage.children[0].value;
public currentPage = JSON.parse(localStorage.getItem("currentPage-train") as any) || this.pageList[0];
public currentNav = localStorage.getItem("currentNav-train") || this.currentPage.children[0].value;
public showArrow = false;
public showContent = true;
@ -87,9 +87,9 @@ export default class HeaderComponent extends Vue {
}
public selectPage(data){
this.currentPage = data;
localStorage.setItem("currentPage",JSON.stringify(data))
localStorage.setItem("currentPage-train",JSON.stringify(data))
this.currentNav = data.value;
localStorage.setItem("currentNav",data.value)
localStorage.setItem("currentNav-train",data.value)
this.navChange()
this.showPageList = false;
this.navLeft = 0;
@ -101,7 +101,7 @@ export default class HeaderComponent extends Vue {
public selectNav(data){
this.currentNav = data.value;
localStorage.setItem("currentNav",data.value)
localStorage.setItem("currentNav-train",data.value)
this.navChange()
}
@ -129,8 +129,8 @@ export default class HeaderComponent extends Vue {
beforeDestory(){
clearInterval(this.timer);
this.timer = null;
localStorage.removeItem("currentPage")
localStorage.removeItem("currentNav")
localStorage.removeItem("currentPage-train")
localStorage.removeItem("currentNav-train")
}
}