This doc describes the use of built-in component prop syntax sugar in GenUI
For
for
syntax sugar allows users to quickly build iterable component templates through the passed iterator
The followings are details:
:for="($index, $item) in $iter_ident"
:for="$item in $iter_ident"
:for="($index, ($item1, $item2, ...)) in $iter_ident"
:for="($index, ()) in $iter_ident"
:for="($index, _) in $iter_ident"
$index
: index$item
: iterator element$iter_ident
: iterator ident
If_ElseIf_Else
The if_else
syntax sugar allows users to conditionally render components. The component will only be rendered if the expression returns true
.
$if_bind_condition
: if conditional statement condition$else_if_bind_condition
: else_if conditional statement condition$()*
: many1, 1 or more$()?
: recognize, 0 or 1
Among them, $($(<label :else_if="$else_if_bind_condition"></label>)*)?
means that else_if
can be present or absent, and if present, it can be multiple
For specific writing and examples, see: if_sugar tests