← Vue.js learning path
Vue.js · Module 2 of 10

Template syntax

Bind data to HTML with Vue's template directives.

📖 Key ideas

  1. Show values with {{ message }}.
  2. Bind attributes with v-bind:src or the shorthand :src.
  3. Listen to events with v-on:click or @click.
  4. v-html renders raw HTML (only use with trusted content).
  5. 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