我正在尝试使用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)
})
但是我在控制台中得到一个空数组,就像这样:
[]
没有错误或任何东西。
对这个简单的任务有什么想法吗?