routing main.js
{
name:"hotel",
path:"/hotel/:id",
component:Hotel
}
-
list.vue page
< router-link: to= "{path:"/hotel/"+item.id}" >
is like this. I want to pass item.id to the hotel.vue page. Click url to jump tohttp://localhost:8080/-sharp/hotel/1
-
I am in the hotel.vue page
mounted(){
console.log(this.$vm.$route.params) //
//,
//$route is not defined
}
can"t get the parameter? How to do
in addition, if you change it to the following < router-link: to= "{path:"/hotel",params: {id:item.id}}" >
, http://localhost:8080/-sharp/hotel
doesn"t know why it doesn"t even have a suffix