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

fix: component slots #2780

Merged
merged 2 commits into from
Apr 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/guide/components/slots.md
Original file line number Diff line number Diff line change
Expand Up @@ -296,11 +296,11 @@ function BaseLayout(slots) {
}
```

## Conditional Slots
## Conditional Slots {#conditional-slots}

Sometimes you want to render something based on whether or not a slot is present.

You can use the [$slots](https://vuejs.org/api/component-instance.html#slots) property in combination with a [v-if](https://vuejs.org/guide/essentials/conditional.html#v-if) to achieve this.
You can use the [$slots](/api/component-instance.html#slots) property in combination with a [v-if](/guide/essentials/conditional.html#v-if) to achieve this.

In the example below we define a Card component with two conditional slots: `header` and `footer`.
When the header / footer is present we want wrap them to provide additional styling:
Expand Down