Is there any way to reuse custom components (not the one from the Kirby Panel UI) inside block preview? Has anyone experience with that?
As an example, you define all your block previews a vue.js components, and now you make a nested block and want to dynamically render one of those previews.
Here’s a cookbook example of nested blocks and their preview plugins:
I wanted to do the same, but instead of the faq
block using its markup for the item, it should reuse the faqItem
block.
Shouldn’t something like that work?
<div @dblclick="open" class="faq">
<h2>{{ content.headline }}</h2>
<div v-html="content.text"></div>
<faq-item v-for="(item, index) in content.blocks" :key="index" v-bind="item" />
</div>
I tried several variants, but as soon as I add the props definition to the faqItem
component – which is necessary for the v-bind
to work – the panel breaks as soon as a field is edited.
I can only find example of the panel native components being used in the cookbook, but never with own components.