Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Forwarding Props to Dynamically Rendered Components using <SanityContent> in Nuxt 3 #922

Open
tulip781 opened this issue Oct 16, 2023 · 0 comments
Labels
question Further information is requested

Comments

@tulip781
Copy link

Hello maintainers and community,

I've been working with NuxtSanity in a Nuxt3 project and making use of the component. I've set it up as follows:

<template>
  <SanityContent :blocks="props.blocks" :serializers="serializers" />
</template>

<script setup>
import SectionElement from './SectionElement.vue'
import BaseFigure from '@/components/elements/media/BaseFigure'
import BaseLoop from '@/components/elements/media/BaseLoop'

const props = defineProps({
  blocks: {
    type: Array,
    default: () => [],
  },
})

const serializers = {
  types: {
    pictureTitled: BaseFigure,
    video: BaseLoop,
  },

  styles: {
    normal: SectionElement,

  },
}
</script>

From my understanding, the component dynamically renders other Vue components based on the serializers provided. I'm trying to figure out if there's a built-in mechanism or a recommended way to forward props to these dynamically generated components. Specifically, I want to pass a prop that can control a transition state inside them.

Has anyone faced a similar issue or can provide guidance on how to achieve this? Any help would be greatly appreciated!

Thank you!

@tulip781 tulip781 added the question Further information is requested label Oct 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

1 participant