Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Access props and data from the Apollo option #26

Closed
yeusiukou opened this issue Jan 25, 2017 · 1 comment
Closed

Access props and data from the Apollo option #26

yeusiukou opened this issue Jan 25, 2017 · 1 comment

Comments

@yeusiukou
Copy link

yeusiukou commented Jan 25, 2017

Is there anyway to access Vue's data and props from the Apollo option? In the following example "name" is undefined. $route.params are also inaccessible

export default {
  // Local state
  data: () => ({
    Trainer: { pokemons: [] },
    loading: 0,
    dialogVisible: false,
    newOpen: false,
    selected: {},
    name: 'Alex'
  }),
  // Apollo GraphQL
  apollo: {
    Trainer: {
      query: queries.Trainers.get,
      variables: {
        name: this.name,
        page: this.$route.params.page
      },
      loadingKey: 'loading',
    }
}
@Akryum
Copy link
Member

Akryum commented Jan 25, 2017

You have to use a function for variables: see the doc

@Akryum Akryum closed this as completed Jan 25, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants