如何解决Gridsome - “类别未在实例上定义但在渲染期间引用”
我正在使用 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}}
感谢您的帮助。 视频。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。