I
I
Ivan Tataush2018-07-16 16:50:41
Vue.js
Ivan Tataush, 2018-07-16 16:50:41

Dynamic url Vuejs + NuxtJS?

You need to create a dynamic url on vuejs.
The problem is that it works on dev, but after the build it says that the page was not found.

axios.get('http://jsonplaceholder.typicode.com/posts/' + this.$route.params.post)
    .then(response => {
        this.post = response.data;
    })
    .catch(e => {
      this.errors.push(e)
    });

Folder structure:
5b4ca403eb2f5569475414.png
the output should be example.com/news/1, example.com/news/2
where 1,2 is the post number

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question