From 7ce2e8f122e8e05f116c3f1dc1deea997f0687ef Mon Sep 17 00:00:00 2001 From: pengda <1111@qq.com> Date: Fri, 29 Aug 2025 14:19:31 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=BC=E8=88=AA=E6=A0=8F=E8=B7=B3=E8=BD=AC?= =?UTF-8?q?=E5=8F=82=E6=95=B0=E6=90=BA=E5=B8=A6=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/SetLeftMenu.vue | 19 ++++++++++++------- src/router/index.js | 1 + src/store/index.js | 9 +++++++++ 3 files changed, 22 insertions(+), 7 deletions(-) diff --git a/src/components/SetLeftMenu.vue b/src/components/SetLeftMenu.vue index d56de69..ff06fb4 100644 --- a/src/components/SetLeftMenu.vue +++ b/src/components/SetLeftMenu.vue @@ -89,7 +89,7 @@ export default { // console.log(this.$parent.$refs.scrollContainer,'this.$refs.sc--rollContainer--'); }, computed: { - ...mapState(['pageTitle']) // 从Vuex映射showSidebar状态到组件的计算属性中 + ...mapState(['pageTitle', 'carryParam']) // 从Vuex映射showSidebar状态到组件的计算属性中 }, methods: { random() { @@ -204,12 +204,17 @@ export default { // 如果 是同一页面 只是页面区域的滚动展示 那么跳转一级路由 let path = item1.path || item.path; if ( this.$route.path !== path) { - // 携带当前所有参数跳转 - this.$router.push({ - path: path, - query: { ...this.$route.query }, // 携带所有查询参数 - params: { ...this.$route.params } // 携带所有路由参数 - }); + if(this.carryParam){ + // 携带当前所有参数跳转 + this.$router.push({ + path: path, + query: { ...this.$route.query }, // 携带所有查询参数 + params: { ...this.$route.params } // 携带所有路由参数 + }); + }else{ + this.$router.push(path); + } + store.commit('SET_PAGETITLE', item.name); } diff --git a/src/router/index.js b/src/router/index.js index 116a572..1e540f7 100755 --- a/src/router/index.js +++ b/src/router/index.js @@ -567,6 +567,7 @@ router.beforeEach((to, from, next) => { }) } if (to.path.includes('/super/ranking/')) { //匹配包含此路径的 侧边栏数据 + store.commit('SET_CARRY_PARAM', false); store.commit('SET_CUSTOMIZE', true); store.commit('SET_SLIDER_MENU', 'rankMenuData'); } diff --git a/src/store/index.js b/src/store/index.js index 93b1baf..ac6f0a2 100755 --- a/src/store/index.js +++ b/src/store/index.js @@ -21,6 +21,7 @@ export default new Vuex.Store({ addServiceList: [], //选中的服务 isLoading: false, //页面loading customize: false, //页面loading + carryParam: true, //携带参数 componentsName: '', currentMenuItem: null, slidermenu: [], @@ -783,6 +784,11 @@ export default new Vuex.Store({ }) { commit('SET_CUSTOMIZE'); }, + SET_CARRY_PARAM({ + commit + }) { + commit('SET_CARRY_PARAM'); + }, SET_SLIDER_MENU({ commit }) { @@ -826,6 +832,9 @@ export default new Vuex.Store({ SET_CUSTOMIZE(state, show) { state.customize = show }, + SET_CARRY_PARAM(state, show) { + state.carryParam = show + }, SHOW_LOADING(state) { state.isLoading = true // state.loadingText = text || '加载中...'