代码之家  ›  专栏  ›  技术社区  ›  user1449456

无法使搜索查询在健全的CMS中工作

  •  3
  • user1449456  · 技术社区  · 6 年前

    我正在尝试使用sanity-cms执行一个非常基本的搜索查询。 这就是为什么 person 我创建的架构如下:

    export default {
      title: "Person",
      name: "person",
      type: "document",
      fields: [
        {
          title: "Name",
          name: "name",
          type: "string",
        }
      ]
    }
    

    我输入了两个不同的个人数据。 这就是我获取数据的方法:

    const client = sanityClient({
      projectId: 'siaj5ql4',
      dataset: 'production',
      useCdn: true
    })
    
    const query = '*[_type == "person"]'
    
    client.fetch(query).then(person => {
      console.log(person)
    })
    

    但是我在控制台中得到一个空数组,就像这样: [] 没有错误或任何东西。 对这个简单的任务有什么想法吗?

    1 回复  |  直到 6 年前
        1
  •  4
  •   bjoerge    6 年前

    推荐文章