{
level: 2,
parentid: 2,
id: 21,
path: 'base-config',
name: 'BaseConfig',
component: () => import('@/views/config/base-config'),
meta: {
title: '基础信息',
icon: require('@/assets/images/config/icon_base_config.png'),
iconSelect: require('@/assets/images/config/icon_base_config_select.png')
}
},
1 name+params传参,参数不会显示在url里
this.$router.push({
name: 'BaseConfig',
params: {
info:JSON.stringify(obj)
}
})
if (this.$route.params.info) {
this.currentInfo = JSON.parse(this.$route.params.info)
}
2、name+query传参,url中会显示参数
this.$router.push({
name: 'BaseConfig',
query: {
info:JSON.stringify(obj)
}
})
if (this.$route.query.info) {
console.log("😆 ~ created ~ this.$route.query.info:", this.$route.query.info)
}
3、path+query传参
this.$router.push({
path: '/config/base-config',
query: {
info:JSON.stringify(obj)
}
})
console.log("😆 ~ created ~ this.$route.params.info:", this.$route.query)