Skip to content

docs: document mixing named and default slots #1946

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

Merged
merged 7 commits into from
Sep 19, 2022

Conversation

noook
Copy link
Contributor

@noook noook commented Aug 31, 2022

vuejs/core#6549

Description of Problem

Regarding this issue, the compiler doesn't inform what's the real problem with mixing named slot and default. This PR updates the documentation to explain how to avoid this error. The compiler error still needs to be clearer.

Proposed Solution

Provide an example on how to use default slots along named slots

Additional Information

@netlify
Copy link

netlify bot commented Aug 31, 2022

Deploy Preview for vuejs ready!

Name Link
🔨 Latest commit ae50b8d
🔍 Latest deploy log https://app.netlify.com/sites/vuejs/deploys/6322a741f0f9dc0009306ef4
😎 Deploy Preview https://deploy-preview-1946--vuejs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

Copy link
Contributor

@skirtles-code skirtles-code left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR!

I think there may be a couple of problems with explaining it this way:

  1. It appears to contradict the example that immediately precedes it, which mixes named slots and the default slot quite happily, without using #default. The problem only occurs when v-slot/#default is explicitly used on the parent tag. If it is omitted then everything works fine.
  2. This new example is using a scoped slot before the concept of scoped slot has been introduced.

I think we may need to move this explanation further down, because scoped slots are the key reason why somebody would run into this problem in the first place. Maybe in the section about Named Scoped Slots?

@noook
Copy link
Contributor Author

noook commented Aug 31, 2022

That's what I did in my first commit, I finally decided to move it earlier after mixing the slots.

I'll do that !

Copy link
Contributor

@skirtles-code skirtles-code left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've made some suggestions below. Let me know if anything isn't clear or if you have any questions. Thanks.

@noook
Copy link
Contributor Author

noook commented Sep 15, 2022

@skirtles-code it's totally clear, I used your suggestions.

Copy link
Contributor

@skirtles-code skirtles-code left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

Copy link
Member

@NataliaTepluhina NataliaTepluhina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@noook thank you for the contribution and thanks to @skirtles-code for the detailed review! PR looks good to me, let's get it merged

@NataliaTepluhina NataliaTepluhina merged commit 480c95a into vuejs:main Sep 19, 2022
@noook noook deleted the patch-1 branch September 20, 2022 01:22
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

Successfully merging this pull request may close these issues.

3 participants