Skip to content
Closed
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
26 changes: 26 additions & 0 deletions src/v2/guide/syntax.md
Original file line number Diff line number Diff line change
Expand Up @@ -217,4 +217,30 @@ The `v-` prefix serves as a visual cue for identifying Vue-specific attributes i
<a @[event]="doSomething"> ... </a>
```

### `v-slot` Shorthand

``` html
<!-- full syntax -->
<foo>
<template v-slot:header="{ msg }">
Message from header: {{ msg }}
</template>

<template v-slot:footer>
A static footer
</template>
</foo>

<!-- shorthand -->
<foo>
<template #header="{ msg }">
Message from header: {{ msg }}
</template>

<template #footer>
A static footer
</template>
</foo>
```

They may look a bit different from normal HTML, but `:` and `@` are valid characters for attribute names and all Vue-supported browsers can parse it correctly. In addition, they do not appear in the final rendered markup. The shorthand syntax is totally optional, but you will likely appreciate it when you learn more about its usage later.