Static GitHub Issues

[3201] Access passed props from page component's asyncData method

prev: svg can't be used in nuxt.js
next: Error production nuxt SSR

What problem does this feature solve?

An inability to access the props passed to a page component from the asyncData function (now that you can pass props to child components #1502/#1591). The data that is downloaded can be dependent on the value of the props, but they are not able to be referenced at the moment from the asyncData function (and potentially the data function).

What does the proposed changes look like?

Could add a props parameter to the asyncData function

asyncData(context, props) {
  if (props.value === 'certainValue') {
    return context.store.dispatch('specialData')
  } else {
    return context.store.dispatch('normalData')
  }
}
<!--cmty--><div align="right"><sub><em>This feature request is available on <a href="https://nuxtjs.cmty.io">Nuxt.js</a> community (<a href="https://nuxtjs.cmty.io/nuxt/nuxt.js/issues/c6861">#c6861</a>)</em></sub></div>