4
The contents are just an expression. It’s pretty much just normal JavaScript but with identifiers scoped to this
and support for Vue filters tagged on the end.
e.g.
<p>{{ first + second }}</p>
<p>{{ first + ' ' + second }}</p>
<p>{{ first + ' comes before ' + second }}</p>
<p>{{ 1 + 2 + 3 + 4 }}</p>
<p>{{ methodCall(first, second) }}</p>
<p>{{ first || second || 'none' }}</p>
<p>{{ first | formatWithAFilter }}</p>
If the expression evaluates to a primitive (strings, numbers, etc.) it will be output using the usual string representation. null
and undefined
are treated like empty strings (similar to Array join
). For an object it will be dumped out as JSON, which can be useful for debugging.
Source:stackexchange.com