← Vue.js learning pathVue.js · Module 2 of 10
Template syntax
Bind data to HTML with Vue's template directives.
📖 Key ideas
- Show values with {{ message }}.
- Bind attributes with v-bind:src or the shorthand :src.
- Listen to events with v-on:click or @click.
- v-html renders raw HTML (only use with trusted content).
- Expressions inside templates must be single expressions.
💡 Real-life example: Template syntax is a fill-in form: Vue writes the right value into each blank.
{{ }}Text interpolation
:attrShorthand for v-bind
@eventShorthand for v-on
v-htmlRenders raw HTML