use*_*456 4 content-management-system sanity groq
我正在尝试使用 Sanity CMS 执行非常基本的搜索查询。这是person我创建的架构的样子:
export default {
title: "Person",
name: "person",
type: "document",
fields: [
{
title: "Name",
name: "name",
type: "string",
}
]
}
Run Code Online (Sandbox Code Playgroud)
我输入了两个不同的 Person 数据。这就是我尝试获取数据的方式:
const client = sanityClient({
projectId: 'siaj5ql4',
dataset: 'production',
useCdn: true
})
const query = '*[_type == "person"]'
client.fetch(query).then(person => {
console.log(person)
})
Run Code Online (Sandbox Code Playgroud)
但是我在控制台中得到一个空数组:[]
没有错误或任何东西。关于这个简单任务的任何想法?
造成这种情况的常见原因有两个:
另请注意,CDN 不能与私有数据集和/或访问令牌一起使用。
| 归档时间: |
|
| 查看次数: |
646 次 |
| 最近记录: |