slidev
slidev copied to clipboard
only one slot is allowed in components
Describe the bug multiple slots in layout is ok, but if we put more than one slots in customized compoents, it raises error:
Plugin: vite:vue
File: /@slidev/slides/1.md:7:1
5 | <template v-slot:first="slotProps">
6 | </template>
7 | <template v-slot:second="slotProps">
| ^
8 | </Comparison>
9 | </template>
at createCompilerError (.../slidev/node_modules/@vue/compiler-core/dist/compiler-core.cjs.js:1328:17)
at emitError (.../slidev/node_modules/@vue/compiler-core/dist/compiler-core.cjs.js:2812:5)
at Object.onclosetag (.../slidev/node_modules/@vue/compiler-core/dist/compiler-core.cjs.js:2179:13)
To Reproduce
the markdown:
---
layout: fact
---
this is test
<Comparison>
::first::
::second::
</Comparison>
the component (Comparison.vue):
<template>
<div>
<div class="container">
<div class="box-1">
<div class="triangle-right" />
<div class="text-left">
{{ left }}
</div>
</div>
<div class="box-2">
<div class="triangle-left" />
<div class="text-right">
{{ right }}
</div>
</div>
<div>
<slot />
</div>
<div>
<slot name="first" />
</div>
<div>
<slot name="second" />
</div>
</div>
</div>
</template>
Desktop (please complete the following information):
- OS: macos
- Browser: firefox
- Slidev version: 0.49.10
The ::slot-name:: syntax sugar seems to only work with slide-level slots currently🤔 We may improve this behavior in the future.
Thanks for quick response and glad to know we'll have this enhancement in the future.
Really love slidev.