Skip to content

Commit 6b57036

Browse files
cpsloalchrisvfritz
authored andcommitted
Updated code example to include closing tag. (#1216)
* Updated code example to include closing tag. * Update syntax examples with ellipses to imply content
1 parent ea89dd6 commit 6b57036

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/v2/guide/syntax.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -95,15 +95,15 @@ Here, the `v-if` directive would remove/insert the `<p>` element based on the tr
9595
Some directives can take an "argument", denoted by a colon after the directive name. For example, the `v-bind` directive is used to reactively update an HTML attribute:
9696

9797
``` html
98-
<a v-bind:href="url"></a>
98+
<a v-bind:href="url"> ... </a>
9999
```
100100

101101
Here `href` is the argument, which tells the `v-bind` directive to bind the element's `href` attribute to the value of the expression `url`.
102102

103103
Another example is the `v-on` directive, which listens to DOM events:
104104

105105
``` html
106-
<a v-on:click="doSomething">
106+
<a v-on:click="doSomething"> ... </a>
107107
```
108108

109109
Here the argument is the event name to listen to. We will talk about event handling in more detail too.
@@ -113,7 +113,7 @@ Here the argument is the event name to listen to. We will talk about event handl
113113
Modifiers are special postfixes denoted by a dot, which indicate that a directive should be bound in some special way. For example, the `.prevent` modifier tells the `v-on` directive to call `event.preventDefault()` on the triggered event:
114114

115115
``` html
116-
<form v-on:submit.prevent="onSubmit"></form>
116+
<form v-on:submit.prevent="onSubmit"> ... </form>
117117
```
118118

119119
You'll see other examples of modifiers later, [for `v-on`](events.html#Event-Modifiers) and [for `v-model`](forms.html#Modifiers), when we explore those features.
@@ -126,20 +126,20 @@ The `v-` prefix serves as a visual cue for identifying Vue-specific attributes i
126126

127127
``` html
128128
<!-- full syntax -->
129-
<a v-bind:href="url"></a>
129+
<a v-bind:href="url"> ... </a>
130130

131131
<!-- shorthand -->
132-
<a :href="url"></a>
132+
<a :href="url"> ... </a>
133133
```
134134

135135
### `v-on` Shorthand
136136

137137
``` html
138138
<!-- full syntax -->
139-
<a v-on:click="doSomething"></a>
139+
<a v-on:click="doSomething"> ... </a>
140140

141141
<!-- shorthand -->
142-
<a @click="doSomething"></a>
142+
<a @click="doSomething"> ... </a>
143143
```
144144

145145
They may look a bit different from normal HTML, but `:` and `@` are valid chars for attribute names and all Vue.js 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.

0 commit comments

Comments
 (0)