Browse Source

导航栏跳转参数携带设置

zq-0828-newMenu
pengda 4 days ago
parent
commit
7ce2e8f122
  1. 19
      src/components/SetLeftMenu.vue
  2. 1
      src/router/index.js
  3. 9
      src/store/index.js

19
src/components/SetLeftMenu.vue

@ -89,7 +89,7 @@ export default {
// console.log(this.$parent.$refs.scrollContainer,'this.$refs.sc--rollContainer--'); // console.log(this.$parent.$refs.scrollContainer,'this.$refs.sc--rollContainer--');
}, },
computed: { computed: {
...mapState(['pageTitle']) // VuexshowSidebar ...mapState(['pageTitle', 'carryParam']) // VuexshowSidebar
}, },
methods: { methods: {
random() { random() {
@ -204,12 +204,17 @@ export default {
// //
let path = item1.path || item.path; let path = item1.path || item.path;
if ( this.$route.path !== path) { if ( this.$route.path !== path) {
// if(this.carryParam){
this.$router.push({ //
path: path, this.$router.push({
query: { ...this.$route.query }, // path: path,
params: { ...this.$route.params } // query: { ...this.$route.query }, //
}); params: { ...this.$route.params } //
});
}else{
this.$router.push(path);
}
store.commit('SET_PAGETITLE', item.name); store.commit('SET_PAGETITLE', item.name);
} }

1
src/router/index.js

@ -567,6 +567,7 @@ router.beforeEach((to, from, next) => {
}) })
} }
if (to.path.includes('/super/ranking/')) { //匹配包含此路径的 侧边栏数据 if (to.path.includes('/super/ranking/')) { //匹配包含此路径的 侧边栏数据
store.commit('SET_CARRY_PARAM', false);
store.commit('SET_CUSTOMIZE', true); store.commit('SET_CUSTOMIZE', true);
store.commit('SET_SLIDER_MENU', 'rankMenuData'); store.commit('SET_SLIDER_MENU', 'rankMenuData');
} }

9
src/store/index.js

@ -21,6 +21,7 @@ export default new Vuex.Store({
addServiceList: [], //选中的服务 addServiceList: [], //选中的服务
isLoading: false, //页面loading isLoading: false, //页面loading
customize: false, //页面loading customize: false, //页面loading
carryParam: true, //携带参数
componentsName: '', componentsName: '',
currentMenuItem: null, currentMenuItem: null,
slidermenu: [], slidermenu: [],
@ -783,6 +784,11 @@ export default new Vuex.Store({
}) { }) {
commit('SET_CUSTOMIZE'); commit('SET_CUSTOMIZE');
}, },
SET_CARRY_PARAM({
commit
}) {
commit('SET_CARRY_PARAM');
},
SET_SLIDER_MENU({ SET_SLIDER_MENU({
commit commit
}) { }) {
@ -826,6 +832,9 @@ export default new Vuex.Store({
SET_CUSTOMIZE(state, show) { SET_CUSTOMIZE(state, show) {
state.customize = show state.customize = show
}, },
SET_CARRY_PARAM(state, show) {
state.carryParam = show
},
SHOW_LOADING(state) { SHOW_LOADING(state) {
state.isLoading = true state.isLoading = true
// state.loadingText = text || '加载中...' // state.loadingText = text || '加载中...'

Loading…
Cancel
Save