Created
June 26, 2021 05:42
-
-
Save devmnj/05a8e0d67cd151c677696effdfe35a1c to your computer and use it in GitHub Desktop.
Custom Prismic slice rendering in Nuxtjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <template> | |
| <div class="container"> | |
| <div class="flex"> | |
| <slice-zone class="subtitle" | |
| :slices="page.data.body1" | |
| :resolver="resolver" /> | |
| </div> | |
| </div> | |
| </template> | |
| <script> | |
| import SliceZone from "vue-slicezone"; | |
| import * as Slices from "@/slices"; | |
| export default { | |
| mounted() {}, | |
| async asyncData({ $prismic }) { | |
| return { | |
| page: await $prismic.api.getSingle("home"), | |
| }; | |
| }, | |
| components: { | |
| SliceZone, | |
| }, | |
| data() { | |
| return { | |
| }; | |
| }, | |
| methods: { | |
| resolver({ sliceName, slice, i }) { | |
| return Slices[sliceName]; | |
| }, | |
| }, | |
| }; | |
| </script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment