[Vuejs]-In nuxt.js how can access the slug values inside asyncData()?

1๐Ÿ‘

โœ…

I had resolved the issue by passing $axios as the first argument in the asyncData functions

  export default {
       async asyncData({ $axios, params }) {
           const user = await $axios.$get(params.id);
           return { user };
       }
    };
๐Ÿ‘คSyam kumar KK

0๐Ÿ‘

You forgot to pass extra prop โ€“ params, and then you have an access to params.

  export default {
       async asyncData({ app, params }) {
           const user = await app.$axios.$get(params.id);
           return { user };
       }
    };
๐Ÿ‘คMajkon

Leave a comment