Skip to content

Update components-slots.md #869

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 1 commit into from
Feb 27, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/v2/guide/components-slots.md
Original file line number Diff line number Diff line change
Expand Up @@ -332,15 +332,15 @@ function (slotProps) {
这样可以使模板更简洁,尤其是在该插槽提供了多个 prop 的时候。它同样开启了 prop 重命名等其它可能,例如将 `user` 重命名为 `person`:

``` html
<current-user v-slot="{ user: person }">>
<current-user v-slot="{ user: person }">
{{ person.firstName }}
</current-user>
```

你甚至可以定义后备内容,用于插槽 prop 是 undefined 的情形:

``` html
<current-user v-slot="{ user = { firstName: 'Guest' } }">>
<current-user v-slot="{ user = { firstName: 'Guest' } }">
{{ user.firstName }}
</current-user>
```
Expand Down