Home

Issue: 3201

Access passed props from page component's asyncData method

[issue link]

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')
  }
}
This feature request is available on Nuxt.js community (#c6861)