Javascript 当使用router.push进行转换时,将道具从一个组件传递到另一个组件

Javascript 当使用router.push进行转换时,将道具从一个组件传递到另一个组件,javascript,vue.js,vuejs2,vue-component,Javascript,Vue.js,Vuejs2,Vue Component,我目前有一个名为courger.Vue的Vue.js组件,当用户访问以下URL时,该组件会通过路由器呈现-http://localhost:8080/summoner/username 在该组件中,我有一个元素,它在单击时触发一个方法,将用户发送到一个新的URL-http://localhost:8080/summoner/username/match/4132479262它呈现不同的组件匹配.vue。像这样: <div @click='specificMatch(match.gameId

我目前有一个名为
courger.Vue
的Vue.js组件,当用户访问以下URL时,该组件会通过路由器呈现-
http://localhost:8080/summoner/username

在该组件中,我有一个
元素,它在单击时触发一个方法,将用户发送到一个新的URL-
http://localhost:8080/summoner/username/match/4132479262
它呈现不同的组件
匹配.vue
。像这样:

<div @click='specificMatch(match.gameId)'>

specificMatch(gameId){
    router.push('/summoner/' + this.summoner + '/match/' + gameId)
}

以下是如何使用
vue路由器
props实现这一点:

{
路径:'/召唤者/:召唤者姓名',
姓名:'召唤者',
组成部分:召唤者,
道具:正确//现在您可以将道具传递到此路线
}
然后,当您要导航到它时:

this.$router.push({name:courger,params:{courdername:this.courger,somedata:'hello'等…})
现在召唤师组件可以在其道具上访问所有这些参数:

//caller.vue
导出默认值{
道具:['somedata',…]
...
}

谢谢!这正是我要找的!
export default new Router({
    mode: 'history',
    base: process.env.BASE_URL,
    routes: [
    {
        path: '/',
        name: 'home',
        component: Home
    },
    {
        path: '/summoner/:summonerName',
        name: 'summoner',
        component: Summoner
    },
    {
        path: '/summoner/:summonerName/match/:matchId',
        name: 'match',
        component: Match
    }
    ]
})