0

i want to make a dynamic url for my e-ticket website using vuejs 2

expectating url like this

https://e-tickets.com/movies/{movie-title}-{movie-id}

example

https://e-tickets.com/movies/black-panter-1203

UPDATE

so i have a flow like this

  1. when user click movie, it will push a url like this "e-ticket.com/movies/1203" first.
  2. after render a view component, my page will hit an API to get movie detail (inc title, synopsis, etc), and parameter/payload API from movie id in URL
  3. after that, API return a response. After get the response, router will change url like this "e-ticket.com/movie/black-panther-1203" but not reload page or something. just replace old url to new url like that
  • Can you show the code of what you have tried so far? Have you read the documentation on dynamic routing with vue-router? https://v3.router.vuejs.org/guide/essentials/dynamic-matching.html#dynamic-route-matching – Gabe Nov 27 '22 at 11:30
  • @Gabe i read it before. but i still dont know how to make like that. Im updated my thread – Chairil Fauzi Firmansyah Nov 27 '22 at 11:33
  • I think programatic routing is what you are looking for: https://v3.router.vuejs.org/guide/essentials/navigation.html#router-push-location-oncomplete-onabort – Gabe Nov 27 '22 at 11:38
  • You mainly want something [like this](https://stackoverflow.com/a/67490633/8816585) in a vanilla Vue project. – kissu Nov 27 '22 at 15:34

0 Answers0