XXX.vue
import apollo from '../configuration/list.js'
....
methods:{
handleList: function() {
this.$apollo.query({
query: apollo,
variables: {
model: this.chooseModelCode || '',
name: this.moduleInputName || '',
pageSize: this.pageInfo.pageSize || 10,
pageNum: this.pageInfo.pageNum || 1
}
}).then(res => {
console.log(res.data)
this.Parse(res.data.result)
console.log(res.data.result)
}).catch(err => {
console.log(err)
})
},
}
list.js
import gql from 'graphql-tag'
const apollo = gql `query result($model: String,$name: String,$pageSize: Int!,$pageNum: Int!){
result(model:$model,name:$name,pageSize:$pageSize,pageNum:$pageNum){
list{
name
gmtCreate
model
}
pageSize
pageNum
}
}`
export default apollo
应该是哪里写的不对,老是报错 Network error: Server response was missing for query 'result'.