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

only one slot is allowed in components #1701

Open
zillionare opened this issue Jun 25, 2024 · 2 comments
Open

only one slot is allowed in components #1701

zillionare opened this issue Jun 25, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@zillionare
Copy link

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
@KermanX
Copy link
Member

KermanX commented Jun 25, 2024

The ::slot-name:: syntax sugar seems to only work with slide-level slots currently🤔 We may improve this behavior in the future.

@KermanX KermanX added the enhancement New feature or request label Jun 25, 2024
@zillionare
Copy link
Author

Thanks for quick response and glad to know we'll have this enhancement in the future.

Really love slidev.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants