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

Scoped slots (slot-scope) issues #178

Open
viktorlarsson opened this issue May 4, 2018 · 3 comments
Open

Scoped slots (slot-scope) issues #178

viktorlarsson opened this issue May 4, 2018 · 3 comments

Comments

@viktorlarsson
Copy link

viktorlarsson commented May 4, 2018

Currently scoped slots in our project, but we have come across when having multiple slots on the same component.

This is an example we are using it at the moment:

vuecomponent.vue

<template>
    <span><slot name="test"></slot></span>
    <button><slot name="test"></slot></button>
</template>

test.html

<vuecomponent>
    <template slot="test" slot-scope="multiple">Testing</template>
</vuecomponent>

vuecomponent.spec.ts

import Vuecomponent from '@/components/vuecomponent.vue';

const test= Vue.component('test', {
   template: `<span>testtest</span>`,
});
const comp = mount(Vuecomponent, {
   slots: {
        'add-button': mount(test),
    },
});

And when we are mounting it using Avoriaz, the following issue is presented in the console:

[Vue warn]: Duplicate presence of slot "test" found in the same render tree - this will likely cause render errors.

Can't find any way on how to define the slot-scope. Is it possible to do this?

@eddyerburgh
Copy link
Owner

Sorry, this isn't possible with avoriaz. You can use vue-test-utils which has a similar API and includes a scopedSlots mounting option.

@viktorlarsson
Copy link
Author

Thank you! Any reason why this won't be implemented?

@eddyerburgh
Copy link
Owner

I don't have time 😛! If someone made a PR I'd be happy to review

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