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

Get the default $scopedSlots even if I do not set the slot-scope attribute #9682

Closed
dxvladislavvolkov opened this Issue Mar 12, 2019 · 6 comments

Comments

Projects
None yet
2 participants
@dxvladislavvolkov
Copy link

dxvladislavvolkov commented Mar 12, 2019

Version

2.6.1

Reproduction link

https://jsfiddle.net/Lw83ej0p/1/

Steps to reproduce

  1. Generate component using render function
  2. Put some elements to the component
  3. Check $scopedSlots of the component

You can see that $scopedSlots has a default function which returns all nested elements.
The attached example illustrates this behavior (open DevTools).

What is expected?

I expect $scopedSlots.default when I set slot-scope attribute

What is actually happening?

I get $scopedSlots.default even if I do not set the slot-scope attribute

@posva

This comment has been minimized.

Copy link
Member

posva commented Mar 12, 2019

That already works with latest Vue

@posva posva closed this Mar 12, 2019

@dxvladislavvolkov

This comment has been minimized.

Copy link
Author

dxvladislavvolkov commented Mar 12, 2019

@posva Which version? I get the same result with vue 2.6.8.
I also discovered that if I set slot-scope for one element I get only it.

@posva

This comment has been minimized.

Copy link
Member

posva commented Mar 12, 2019

Oh, you want default to not be there! The title made it look the other way around. This is intentional and we cannot introduce such a breaking change anyway

@dxvladislavvolkov

This comment has been minimized.

Copy link
Author

dxvladislavvolkov commented Mar 12, 2019

@posva How can I check this default? I mean if I set slot-scope attribute or not. Because I need to use an element with this attribute only.

@dxvladislavvolkov

This comment has been minimized.

Copy link
Author

dxvladislavvolkov commented Mar 12, 2019

@posva In the older version (2.5.7) I get elements only with slot-scope. You can see an example here https://jsfiddle.net/d20qho1y/ . In the example, I get an error because elements don't have the attribute. After updated vue, I got some problem.

@posva

This comment has been minimized.

Copy link
Member

posva commented Mar 12, 2019

It's part of the slot/scoped slot unification and it was part of v2.6 release: https://github.com/vuejs/vue/releases/tag/v2.6.0
you shouldn't be using slots and scoped slots with the same name for different purposes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.