我的父路由本身要携带参数 aa
但是里面的子路由也要携带参数bb 但是路径中的aa就会不见
http://localhost:8080/#/index/1 (1是aa)这个地址会有一个页面 然后在这个里面有一个子路由跳转 我想要的是 http://localhost:8080/#/index/1/12 (1是aa 12是bb)
但是每次点击他跳转的都是 http://localhost:8080/#/index/12
每次父路由里的参数aa都没有了
这是为什么呀?
点击跳转代码:
<router-link :to="item.bb" >{{item.name}}</router-link>
路由:
{
path: '/index/:aa',
name: 'index',
component: index,
children:[
{path:'bb',name:'detail',component:detail},
]
},
然后我有尝试加在<router-link>里面加append 但是第一次是可以的 我再点别的分类就会不对了
aa需要动态添加
<router-link :to="/index/demo" >{{item.name}}</router-link>
此时的demo就相当于aa
<router-link :to="/index/:aa" >{{item.name}}</router-link>
况且aa 是这样取的this.$route.params.aa
{
这里的name,component是这样取的 this.$route.query.name ,this.$route.query.component
所以 ‘vue 子路由的参数覆盖父路由携带的参数 ’
这个问题本身就是不存在的