Vue.js GraphQL查询-按ID查询

Vue.js GraphQL查询-按ID查询,vue.js,graphql,strapi,vue-apollo,Vue.js,Graphql,Strapi,Vue Apollo,我已经在本地安装了,我正在尝试理解如何通过ID(或slug)查询文章。当我打开GraphQL游乐场时,我可以使用以下工具获取所有文章: query Articles { articles { id title content image { url } category { name } } } 答复是: { "data": { "articles": [

我已经在本地安装了,我正在尝试理解如何通过ID(或slug)查询文章。当我打开GraphQL游乐场时,我可以使用以下工具获取所有文章:

query Articles {
  articles {
    id
    title
    content
    image {
      url
    }
    category {
      name
    }
  }
}
答复是:

{
  "data": {
    "articles": [
      {
        "id": "1",
        "title": "Thanks for giving this Starter a try!",
        "content": "\n# Thanks\n\nWe hope that this starter will make you want to discover Strapi in more details.\n\n## Features\n\n- 2 Content types: Article, Category\n- Permissions set to 'true' for article and category\n- 2 Created Articles\n- 3 Created categories\n- Responsive design using UIkit\n\n## Pages\n\n- \"/\" display every articles\n- \"/article/:id\" display one article\n- \"/category/:id\" display articles depending on the category",
        "image": {
          "url": "/uploads/blog_header_network_7858ad4701.jpg"
        },
        "category": {
          "name": "news"
        }
      },
      {
        "id": "2",
        "title": "Enjoy!",
        "content": "Have fun!",
        "image": {
          "url": "/uploads/blog_header_balloon_32675098cf.jpg"
        },
        "category": {
          "name": "trends"
        }
      }
    ]
  }
}
但是,当我尝试使用ID和变量获取文章时,就像在GraphQL游乐场中使用以下内容一样

查询:

query Articles($id: ID!) {
  articles(id: $id) {
    id
    title
    content
    image {
      url
    }
    category {
      name
    }
  }
}
变量:

{
  "id": 1
}
我得到一个错误:

...
"message": "Unknown argument \"id\" on field \"articles\" of type \"Query\"."
...
区别是什么?为什么我不能像Github回购的例子那样获取数据


感谢您的帮助。

这是
文章
文章
作为查询的区别。如果使用单数,则可以使用ID作为参数

,这是
文章
文章
之间的区别。如果你使用单数,你可以使用ID作为参数,很好,它正在工作。非常感谢@daanvanham你能回答这个问题让Riki接受吗?