You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Updates the element's `textContent`. If you need to update the part of `textContent`, you should use `{% raw %}{{ Mustache }}{% endraw %}` interpolations.
Updates the element's `innerHTML`. The contents are inserted as plain HTML - data bindings are ignored. If you need to reuse template pieces, you should use [functional components](!!TODO).
879
+
880
+
<pclass="tip">Dynamically rendering arbitrary HTML on your website can be very dangerous because it can easily lead to [XSS attacks](https://en.wikipedia.org/wiki/Cross-site_scripting). Only use `v-html` on trusted content and **never** on user-provided content.</p>
Conditionally render the element based on the truthy-ness of the expression value. The element and its contained data bindings / components are destroyed and re-constructed during toggles. If the element is a `<template>` element, its content will be extracted as the conditional block.
Render the element or template block multiple times based on the source data. The directive's value must use the special syntax `alias in expression` to provide an alias for the current element being iterated on:
942
+
943
+
```html
944
+
<divv-for="item in items">
945
+
{{ item.text }}
946
+
</div>
947
+
```
948
+
949
+
Alternatively, you can also specify an alias for the index (or the key if used on an Object):
950
+
951
+
```html
952
+
<divv-for="(item, index) in items"></div>
953
+
<divv-for="(key, val) in object"></div>
954
+
<divv-for="(key, val, index) in object"></div>
955
+
```
956
+
957
+
The detailed usage for `v-for` is explained in the guide section linked below.
958
+
959
+
-**See also:**[List Rendering](/guide/list.html).
960
+
961
+
### v-on
962
+
963
+
-**Shorthand:**`@`
964
+
965
+
-**Expects:**`Function | Inline Statement`
966
+
967
+
-**Argument:**`event (required)`
968
+
969
+
-**Modifiers:**
970
+
-`.stop` - call `event.stopPropagation()`.
971
+
-`.prevent` - call `event.preventDefault()`.
972
+
-`.capture` - add event listener in capture mode.
973
+
-`.self` - only trigger handler if event was dispatched from this element.
974
+
-`.{keyCode | keyAlias}` - only trigger handler on certain keys.
975
+
-`.native` - listen for a native event on the root element of component.
976
+
977
+
-**Usage:**
978
+
979
+
Attaches an event listener to the element. The event type is denoted by the argument. The expression can either be a method name or an inline statement, or simply omitted when there are modifiers present.
980
+
981
+
When used on a normal element, it listens to **native DOM events** only. When used on a custom element component, it also listens to **custom events** emitted on that child component.
982
+
983
+
When listening to native DOM events, the method receives the native event as the only argument. If using inline statement, the statement has access to the special `$event` property: `v-on:click="handle('ok', $event)"`.
Dynamically bind one or more attributes, or a component prop to an expression.
1043
+
1044
+
When used to bind the `class` or `style` attribute, it supports additional value types such as Array or Objects. See linked guide section below for more details.
1045
+
1046
+
When used for prop binding, the prop must be properly declared in the child component.
1047
+
1048
+
When used without an argument, can be used to bind an object containing attribute name-value pairs. Note in this mode `class` and `style` does not support Array or Objects.
Skip compilation for this element and all its children. You can use this for displaying raw mustache tags. Skipping large numbers of nodes with no directives on them can also speed up compilation.
1115
+
1116
+
-**Example:**
1117
+
1118
+
```html
1119
+
<spanv-pre>{{ this will not be compiled }}</span>
1120
+
```
1121
+
1122
+
### v-cloak
1123
+
1124
+
-**Does not expect expression**
1125
+
1126
+
-**Usage:**
1127
+
1128
+
This directive will remain on the element until the associated Vue instance finishes compilation. Combined with CSS rules such as `[v-cloak] { display: none }`, this directive can be used to hide un-compiled mustache bindings until the Vue instance is ready.
1129
+
1130
+
-**Example:**
1131
+
1132
+
```css
1133
+
[v-cloak] {
1134
+
display: none;
1135
+
}
1136
+
```
1137
+
1138
+
```html
1139
+
<divv-cloak>
1140
+
{{ message }}
1141
+
</div>
1142
+
```
1143
+
1144
+
The `<div>` will not be visible until the compilation is done.
1145
+
1146
+
### v-once
1147
+
1148
+
-**Does not expect expression**
1149
+
1150
+
-**Details:**
1151
+
1152
+
Evaluates the element and component **once** only.
1153
+
1154
+
```html
1155
+
<!-- single element -->
1156
+
<spanv-once>This will never change: {{msg}}</span>
0 commit comments