Hello I've created a custom slice called body_content. It seems to be registered correctly under @slices/, and can be see when calling prismic sm --ls
.
I'm using Nuxt.js 2.14.
// model.json
{
"type": "Slice",
"fieldset": "BodyContent Template",
"description": "Template model for BodyContent",
"icon": "text_format",
"display": "list",
"non-repeat": {
"content": {
"type": "StructuredText",
"config": {
"multi": "paragraph, preformatted, heading1, heading2, heading3, heading4, heading5, heading6, strong, em, hyperlink, image, embed, list-item, o-list-item, o-list-item",
"allowTargetBlank": true,
"label": "Content",
"placeholder": "Once upon a time.."
}
}
}
}
<template>
<section class="ps" v-bind="theme.wrapper">
<div class="ps__wrap">
<ps-description v-if="slice.primary.content" :field="slice.primary.content" :theme="theme.description" :align="theme.align" />
<template v-else>
<h1>Empty textContent</h1>
<p v-if="endpoint">
Write content <a target="_blank" :href="endpoint">in your writing room</a>
</p>
</template>
</div>
</section>
</template>
<script>
import { PsDescription } from 'vue-essential-slices/src/components';
export default {
props: ['slice', 'theme'],
name: 'TextContent',
computed: {
endpoint() {
return this.$prismic && this.$prismic.apiEndpoint
? this.$prismic.apiEndpoint.split('/').slice(0, -2).join('/').replace('cdn.', '')
: null
}
},
components: {
PsDescription,
}
}
</script>
<style scoped lang="scss">
@import "vue-essential-slices/src/styles/styles.scss";
.ps {
padding: {
top: 0;
bottom: 0;
}
}
.ps__wrap {
padding: {
top: calc(var(--v-space) / 2);
bottom: calc(var(--v-space) / 2);
right: var(--c-margin);
left: var(--c-margin);
}
background: #eeeeee;
color: #111;
}
</style>
So far so good. However whenever I build my site yarn generate
, my site displays the following error;
body_content error
Prismic API references a slice_type
that could not be matched by the SliceZone.
Did you register libraries path correctly?
If you did, make sure this slice_type
can be matched with one of your components.
Source available here;