Directives
asd
v-text
v-html
It can easily lead to XSS attacks.
Scoped styles will not apply to content inside v-html, because that HTML is not processed by Vue's template compiler.
v-show
v-if
v-else
v-else-if
v-for
v-on
v-bind
v-model
v-model
can be used on a component to implement a two-way binding.
Limited to: input, select, textarea and components
Modifiers:
.lazy
- listen tochange
events instead ofinput
.number
- cast valid input string to numbers.trim
- trim input
When used on a component, v-model instead expands to this:
Now v-model should work perfectly with this component:
arguments
By default, v-model on a component uses modelValue as the prop and update:modelValue as the event.
modifiers
Make custom modifiers
Modifiers for v-model with arguments
For v-model
bindings with both argument and modifiers, the generated prop name will be arg + "Modifiers"
v-slot
v-pre
Inside the element with v-pre, all Vue template syntax will be preserved and rendered as-is. The most common use case of this is displaying raw mustache tags.
v-once
On subsequent re-renders, the element/component and all its children will be treated as static content and skipped. This can be used to optimize update performance.