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

A better way to check if slot is present? #4321

Closed
frederikhors opened this issue Jan 26, 2020 · 2 comments
Closed

A better way to check if slot is present? #4321

frederikhors opened this issue Jan 26, 2020 · 2 comments

Comments

@frederikhors
Copy link

Is there a better way to check if slot is present?

Currently I found online this for a Modal:

<script>
    const has_footer = (arguments[1].$$slots || {}).hasOwnProperty('footer')
</script>

{#if has_footer}
    <div class="modal-footer">
        <slot name="footer" />
    </div>
{/if}

What do you think about?

@Conduitry
Copy link
Member

See #2106.

@frederikhors
Copy link
Author

For people coming here, there it is a solution today working: #2106 (comment)

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

No branches or pull requests

2 participants