diff --git a/src/components/SliderScond.vue b/src/components/SliderScond.vue index 073e4ac..64e55a4 100644 --- a/src/components/SliderScond.vue +++ b/src/components/SliderScond.vue @@ -81,6 +81,7 @@ export default { let subtitle = this.renderKeyNew.subtitle; this.activeFloor = newVal[this.curIndex]?.list?.[0][subtitle]; this.componentsName = newVal[this.curIndex]?.list?.[0]?.componentsName || ''; + store.commit('SET_CURRENTMENUITEM', newVal[this.curIndex]?.list?.[0]); } }, mounted() { @@ -183,6 +184,7 @@ export default { // }, 1000) // } setActiveCur(item1, item, index) { + store.commit('SET_CURRENTMENUITEM', item1); this.curIndex = index; let subtitle = this.renderKeyNew.subtitle; let domName = this.renderKeyNew.domName; diff --git a/src/router/index.js b/src/router/index.js index cf187a1..697aaa0 100755 --- a/src/router/index.js +++ b/src/router/index.js @@ -575,6 +575,11 @@ router.beforeEach((to, from, next) => { next(); }); router.afterEach(() => { + // 清除存储的currentMenuItem + if(!store.state.showSecondSide && store.state.currentMenuItem){ + store.commit('SET_CURRENTMENUITEM',null); + } + // 添加延迟确保过渡效果 setTimeout(() => { store.dispatch('hideLoading') diff --git a/src/store/index.js b/src/store/index.js index 2978c89..f789862 100755 --- a/src/store/index.js +++ b/src/store/index.js @@ -18,6 +18,7 @@ export default new Vuex.Store({ isLoading: false, //页面loading customize: false, //页面loading componentsName:'', + currentMenuItem:null, slidermenu:[], rankMenuData: [{ index: '1', @@ -558,8 +559,16 @@ export default new Vuex.Store({ }) { commit('SET_COMPONENTS_NAME') }, + SET_CURRENTMENUITEM({ + commit + }) { + commit('SET_CURRENTMENUITEM') + }, }, mutations: { + SET_CURRENTMENUITEM(state,data){ + state.currentMenuItem = JSON.parse(JSON.stringify(data)); + }, SET_COMPONENTS_NAME(state,name){ state.componentsName = name; },