How do vue routes pass parameters? How to get the parameters on the second page

routing main.js

{
    name:"hotel",
    path:"/hotel/:id",
    component:Hotel
}
  1. 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 to http://localhost:8080/-sharp/hotel/1

  2. 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

.
Apr.11,2021

< router-link: to= "{path:'/hotel',params: {id:item.id}}" >


< router-link: to=' {name: "hotel", params: {id:item.id}}'>
try


print this.route will report an error $route is not defined , do I also need to import vue-router in hotel.vue? I actually quote


this.$route.params


the < router-link: to=' {name: "hotel", params: {id:item.id}}'> that I got with this seems to be because params needs name to get

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e47582-59c76.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e47582-59c76.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?