How to get Query params in VueJs 3?

I want to make search page which after i click its button will be redirect to another page. And this page will be like this

http://localhost:8080/search?q=foo

and my router index.js looks like this

const routers = [
  
    {
      path: '/search',
      name: 'Search',
      component: SearchPage,
      props: route => ( { query: route.query.q } )
    }
  ]

and the question is how do i get the query value in target page SearchPage, in VueJs 3?
this Answer still confusing me, because not using composition API and not in vuejs 3

15 thoughts on “How to get Query params in VueJs 3?”

Leave a Comment