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

docs: add an example for slots components with props #1376

Merged
merged 3 commits into from
Dec 18, 2019
Merged

docs: add an example for slots components with props #1376

merged 3 commits into from
Dec 18, 2019

Conversation

hiendv
Copy link
Contributor

@hiendv hiendv commented Dec 17, 2019

Because many people including me (:rofl:) were struggling to mount slots components with props, this PR introduces an example for the case.
Example:

<!-- Component.vue -->
<template>
  <div><slot/></div>
</template>

<!-- Child.vue -->
<template>
  <p>{{ foo }}</p>
</template>
<script>
export default {
  props: {
    foo: {
      type: String,
      required: true
    }
  }
}
</script>

<!-- Expected mounting -->
<component>
  <child foo="bar"></child>
  <child foo="qux"></child>
</component>

Btw, I don't really know if this fits into the api docs or common tips.

Copy link
Member

@afontcu afontcu left a comment

Choose a reason for hiding this comment

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

LGTM 👍 I think it would be "too much" to add this to the Common tips section, as this is not a common scenario – as far as I can tell!

Copy link
Collaborator

@JessicaSachs JessicaSachs left a comment

Choose a reason for hiding this comment

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

Just needs a little more context to explain to the developer what kind of Components this will help test. Everything looks great implementation-wise ✅

docs/api/options.md Outdated Show resolved Hide resolved
Copy link
Collaborator

@JessicaSachs JessicaSachs left a comment

Choose a reason for hiding this comment

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

💯Super! Thank you.

@JessicaSachs JessicaSachs merged commit 1888864 into vuejs:dev Dec 18, 2019
@hiendv hiendv deleted the docs-api-options-slots branch December 18, 2019 04:21
@vue-bot
Copy link

vue-bot commented Dec 18, 2019

Hey @hiendv, thank you for your time and effort spent on this PR, contributions like yours help make Vue better for everyone. Cheers! 💚

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.

4 participants