Skip to content

Commit 8044d0e

Browse files
fix: explain how to omit dynamic attributes (#745)
1 parent b4c8aad commit 8044d0e

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/guide/template-syntax.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,15 @@ Mustaches cannot be used inside HTML attributes. Instead, use a [`v-bind` direct
4949
<div v-bind:id="dynamicId"></div>
5050
```
5151

52-
In the case of boolean attributes, where their mere existence implies `true`, `v-bind` works a little differently. In this example:
52+
If the bound value is `null` or `undefined` then the attribute will not be included on the rendered element.
53+
54+
In the case of boolean attributes, where their mere existence implies `true`, `v-bind` works a little differently. For example:
5355

5456
```html
5557
<button v-bind:disabled="isButtonDisabled">Button</button>
5658
```
5759

58-
If `isButtonDisabled` has the value of `null` or `undefined`, the `disabled` attribute will not even be included in the rendered `<button>` element.
60+
The `disabled` attribute will be included if `isButtonDisabled` has a truthy value. It will also be included if the value is an empty string, maintaining consistency with `<button disabled="">`. For other falsy values the attribute will be omitted.
5961

6062
### Using JavaScript Expressions
6163

0 commit comments

Comments
 (0)