我正在使用 Gridsome 博客启动器,并且我正在尝试在帖子上方添加一个类别列表:
下面是查询。虽然它/__explore
在应用程序本身上按预期工作,但我得到了error: vue.runtime.esm.js?2b0e:619 [Vue warn]: Property or method "category" is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option or for class-based components, by initializing the property.
<page-query>
{
metadata {
sanityOptions {
projectId
dataset
}
}
posts: allSanityPost(sortBy: "publishedAt") {
edges {
node {
id
title
slug {
current
}
categories {
id
title
}
publishedAt(format: "D. MMMM YYYY")
_rawExcerpt
mainImage {
asset {
_id
url
}
caption
alt
hotspot {
x
y
height
width
}
crop {
top
bottom
left
right
}
}
}
}
}
categories: allSanityCategory(sortBy: "publishedAt") {
edges {
node {
id
title
}
}
}
有了那个错误,当我用“a”而不是填充它时,它仍然显示两个类别,正如预期的那样{{category.title}}
谢谢你的帮助。艾维。