[Vuejs]-404 (Not Found) while trying to access single post with Vue 3 and Axios

0👍

UPDATE: OP fixed the issue by serving his JSON file with a server, now it’s working great.


Here, you probably want something like this rather than a prop

const res = await axios.get('../../data/data.json/' + this.$route.params.id)

Props are used in a child/parent content, to pass some state down.
Here, you can access the value of your URL directly (router being global) and remove the props part.

Leave a comment