【发布时间】:2019-12-30 18:54:20
【问题描述】:
我想做一个 GraphQL 查询,从我的 Vue 应用程序的数据字段中获取一些数据。但是,当我设置变量挂钩并尝试使用 this.object 引用我需要的对象时,我得到一个无法读取未定义的“xxx”。
apollo: {
question: {
query: gql `
query question($id: Int!) {
question(id: $id){
...
}
}
`, variables: { id: this.presentQuestionId}
}
},
Uncaught TypeError: Cannot read property 'presentQuestionId' of undefined 是不断出现的错误消息。
【问题讨论】:
标签: vue.js graphql apollo vue-apollo