The vue parameter passes the query string

vue project, I have an order (order) list page, the corresponding path is: test/order/all,
and an order details page, corresponding path: test/order/detail?id=123456
want to dynamically route matching according to the order id, because there are strings (question mark, equal sign, order number) in the path, how should I write my Path?


  
  { 
  path:"/order/detail?id=:id",
  component:OrderDetail,
},


 Path

vue-router dynamic routes are matched by / path/:id .

// 1
 { 
  path:'/order/detail/:id',
  component:OrderDetail
}
OrderDetailthis.$route.params.id

// 2
`path` '?q={id}' : /order/detail/id?q=123
this.$route.query.idid
For the operation of

advanced points, you can also use props:true to decouple.

ide/essentials/dynamic-matching.html" rel=" nofollow noreferrer "> official website documentation


1. Dynamic routing means

{

  path:'/order/detail:id',
  component:OrderDetail,

},

    
  `this.router.push({path:'/order/detail/132465'})`
URL /order/detail  (`this.$route.params.id`  )

2. Your requirement is to pass parameters to url

:
 `this.router.push({path:'/order/detail',query{id:132}})`
this.$route.query.id
Menu