[Vuejs]-How to use Nuxt Context to call Axios request with param

0👍

You can access your params from Context.

Context is available in special nuxt lifecycle areas like asyncData, fetch, plugins, middleware and nuxtServerInit.

-1👍

In Nuxt, with asyncData hook you can get query parameters from the route context key.

Please read the Nuxt.js Context documentation. The context provides additional objects/params from Nuxt to Vue components

With your-domain/?user=wonderman

asyncData({ route: { query: queryParams} }) {},

variable queryParams is an object:

{ user: "wonderman" }

Leave a comment