1.先看路由配置文件:
{ path: 'detail/:No', name: 'waybill-declaration-detail', component: () => import('@/views/wayb/Detail'), meta: { redirect: true, title: '運單' } }
2.編寫跳轉事件
click: () => { this.$router.push({ name: 'waybill-declaration-detail', }
這樣跳轉是匹配不上的,如果做了路由為空跳轉的到首頁, 那么本次跳轉就會跳到首頁。
注意:上面的路由配置的path,里面的參數No是動態的,但是參數會加到路由上去,
所以,事件里面也要加上參數No,需要全匹配
3.正確寫法
click: () => { this.$router.push({ name: 'waybill-declaration-detail', params: { No:2323 } }) }
https://www.icode9.com/content-4-760709.html