 
      
      
    2019-12-10 前端達(dá)人
一. 通過router-link進(jìn)行跳轉(zhuǎn)
<router-link
:to="{
path: 'yourPath',
    params: {
    name: 'name',
        dataObj: data
},
query: {
    name: 'name',
        dataObj: data
}
}">
</router-link>
二. 通過編程導(dǎo)航 $router進(jìn)行路由跳轉(zhuǎn)
1.路徑后拼接參數(shù)
通過路徑后直接拼接來(lái)傳遞參數(shù)
getDescribe(id) {
// 直接調(diào)用$router.push 實(shí)現(xiàn)攜帶參數(shù)的跳轉(zhuǎn)
        this.$router.push({
          path: /describe/${id},
        })
對(duì)應(yīng)路由配置
注意:此方法需要修改對(duì)應(yīng)路由配置,需要在path中添加/:id來(lái)對(duì)應(yīng) $router.push 中path攜帶的參數(shù)。
 {
     path: '/describe/:id',
     name: 'Describe',
     component: Describe
   }
獲取傳遞的參數(shù)值
this.$route.params.id
藍(lán)藍(lán)設(shè)計(jì)的小編 http://www.ynkmey.cn