我不明白为什么控制台中会出现此错误
import gql from 'graphql-tag' // import gql
const getBooksQuery = gql`query // describing query
{
books{
name
id
}
}
`;
export default {
name: "BookList", // template name
apollo: { // apollo instance
query: getBooksQuery // query
}
}
我究竟做错了什么?
您必须命名 apollo 属性(docs https://akryum.github.io/vue-apollo/api/smart-query.html#options, e.g bookList
):
export default {
name: "BookList", // template name
apollo: {
bookList: {
query: getBooksQuery // query
}
}
}
甚至更简单(当你不需要任何配置时)
apollo: {
bookList: getBooksQuery
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)