
上QQ阅读APP看书,第一时间看更新
Expressions
If a directive requires a value, it will be anexpression.
In the JavaScript language, expressions are small, evaluable statements that produce a single value. Expressions can be used wherever a value is expected, for example in the parenthesis of anifstatement:
if (expression) { ... }
The expression here could be any of the following:
- A mathematical expression, for examplex + 7
- A comparison, for examplev <= 7
- A Vuedataproperty, for examplethis.myval
Directives and text interpolations both accept expression values:
<p v-dir="someExpression">{{ firstName + " " + lastName }}</p>