[Vuejs]-In nuxt.js (vue.js), no parameters are passed in refresh (F5)

0👍

You don’t need the router! Nuxt include an helper to catch parameters.

The name of your page file must be _name.vue,
Then, to get the param, you can directly use context.params.name.

Read the doc about dynamic routes : https://nuxtjs.org/guide/routing#dynamic-routes


Another point, enjoy the advantages offered by the ES6 to simplify your code 😉

async asyncData ({ params }) {
  const { data } = await axios.get ('/users/' + params.name)
  return {
    user: data.info
  }
}

Leave a comment