Hi,
I'm having trouble rendering slices in my gridsome project.
This is my graphql query:
<page-query>
query Content($uid: String!, $lang: String!) {
prismic {
content(uid: $uid, lang: $lang) {
title
body {
... on Prismic_ContentBodyText {
textBlock: primary {
text
}
}
... on Prismic_ContentBodyImage_gallery {
imageGallery: fields {
image_captions
gallery_image
}
}
__typename
}
_meta {
lang
firstPublicationDate
alternateLanguages {
id
uid
lang
}
}
}
}
}
</page-query>
Then i loop over the body:
<div v-for="(item, index) in content.body" :key="index">
<div v-if="item.textBlock">
<pre>
{{item.textBlock}}
</pre>
</div>
<div v-if="item.imageGallery">
<pre>
{{item.imageGallery}}
</pre>
</div>
</div>
But then i'm lost. The output for one of the textBlocks is this:
{
"text": [
{
"type": "o-list-item",
"text": "sadasdasd",
"spans": []
},
{
"type": "o-list-item",
"text": "asdasdasd",
"spans": []
},
{
"type": "o-list-item",
"text": "asddasdas",
"spans": []
},
{
"type": "list-item",
"text": "fsdsdfsd",
"spans": []
},
{
"type": "list-item",
"text": "sdfsdfsdf",
"spans": []
},
{
"type": "list-item",
"text": "sdfsdfsdf",
"spans": []
},
{
"type": "paragraph",
"text": "",
"spans": []
},
{
"type": "paragraph",
"text": "Text pagina",
"spans": [
{
"start": 5,
"end": 11,
"type": "strong"
}
]
},
{
"type": "paragraph",
"text": "sdfsdfsdfsdf",
"spans": [
{
"start": 0,
"end": 12,
"type": "hyperlink",
"data": {
"id": "X9KrbRIAACkAyuSP",
"type": "content",
"tags": [],
"slug": "test-content",
"lang": "nl-nl",
"uid": "test-content",
"link_type": "Document",
"isBroken": false
}
}
]
},
{
"type": "image",
"url": "https://images.prismic.io/slicemachine-blank/6b2bf485-aa12-44ef-8f06-dce6b91b9309_dancing.png?auto=compress,format",
"alt": null,
"copyright": null,
"dimensions": {
"width": 2048,
"height": 1536
}
}
]
}
But how do i render this output?