Skip to content

Commit 8971c66

Browse files
committed
v-attr set properties
1 parent 787278d commit 8971c66

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

source/api/directives.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ Alternatively, you can bind the directive directly to an Object. The keys of the
6161

6262
Internally, {{ Mustache }} interpolations inside attributes are compiled into computed `v-attr` directives.
6363

64+
Starting in 0.12.8, `v-attr` also sets the corresponding property on the element if the property exists. For example, `<input value="{% raw %}{{val}}{% endraw %}">` will not only update the attribute, but also set the value property. If the element doesn't have a corresponding property for the bound attribute, it will not be set.
65+
6466
<p class="tip">You should use `v-attr` instead of mustache binding when setting the `src` attribute on `<img>` elements. Your templates are parsed by the browser before being compiled by Vue.js, so the mustache binding will cause a 404 when the browser tries to fetch it as the image's URL.</p>
6567

6668
### v-style

0 commit comments

Comments
 (0)