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

Add v-slot support in scopedSlots property, fix #1457 #1485

Merged
merged 3 commits into from Mar 23, 2020

Conversation

dobromir-hristov
Copy link
Contributor

@dobromir-hristov dobromir-hristov commented Mar 23, 2020

This PR adds support for providing templates with v-slot and the v-slot shorthand syntax (#default). It also supports distructuring. closes #1457

What kind of change does this PR introduce? (check at least one)

  • Bugfix
  • Feature
  • Code style update
  • Refactor
  • Build-related changes
  • Other, please describe:

Does this PR introduce a breaking change? (check one)

  • Yes
  • No

If yes, please describe the impact and migration path for existing applications:

The PR fulfills these requirements:

Other information:

Copy link
Member

@lmiller1990 lmiller1990 left a comment

Choose a reason for hiding this comment

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

Wow, you figured this out, nice job! I have a question:

  1. does this work correctly with a #named slot? We only have a test for #default (assuming it does but kind of hard to tell just by looking at the code)

Other than that, code looks good - those are some ugly regexps, lol (not your fault, though). I'm guessing there is some similar regexps buried inside the Vue template compiler somewhere.

@dobromir-hristov
Copy link
Contributor Author

The regex'es are mostly to catch v-slot and #slotname in the provided slot string.

The uglier one is to remove v-slot from template tags, as you saw, the compileToTemplate breaks if it finds v-slot or its shorthadn in a root template tag.

I have pushed an extra assertion for none default slots as well.

@lmiller1990
Copy link
Member

Yeah I figured out what the regexps did, thanks to your good naming of variables. Let's merge this when the tests are passing! I think we should also look at doing a release when #1473 is merged, since we merged a bunch of good fixes lately.

@dobromir-hristov dobromir-hristov merged commit 4df7619 into dev Mar 23, 2020
@dobromir-hristov dobromir-hristov deleted the feature/update-scope-slot-detection branch March 23, 2020 10:44
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.

slotProps are not available in scoped slot with new v-slot syntax
2 participants