add if statements to test and rsx usage example
This commit is contained in:
1 parent
ab2b9fb34e
commit
c0f345e775
3 files changed
+14
-2
No files matched your search
@@ -10,6 +10,8 @@ fn basic_syntax_is_a_template(cx: Scope) -> Element {
|
||||
div { key: "12345",
|
||||
class: "asd",
|
||||
class: "{asd}",
|
||||
class: if true { "{asd}" },
|
||||
class: if false { "{asd}" },
|
||||
onclick: move |_| {},
|
||||
div { "{var}" }
|
||||
div {
|
||||
@@ -37,7 +39,7 @@ fn dual_stream() {
|
||||
LoadTemplate { name: "template", index: 0, id: ElementId(1) },
|
||||
SetAttribute {
|
||||
name: "class",
|
||||
value: (&*bump.alloc("ast 123".into_value(&bump))).into(),
|
||||
value: (&*bump.alloc("asd 123 123".into_value(&bump))).into(),
|
||||
id: ElementId(1),
|
||||
ns: None,
|
||||
},
|
||||
|
||||
@@ -121,7 +121,12 @@ impl Parse for ElementAttrValue {
|
||||
} else {
|
||||
ElementAttrValue::AttrOptionalExpr {
|
||||
condition: *if_expr.cond,
|
||||
value: Box::new(syn::parse2(if_expr.then_branch.into_token_stream())?),
|
||||
value: {
|
||||
let stmts = if_expr.then_branch.stmts;
|
||||
Box::new(syn::parse2(quote! {
|
||||
#(#stmts)*
|
||||
})?)
|
||||
},
|
||||
}
|
||||
}
|
||||
} else if input.peek(LitStr) {
|
||||
|
||||
Reference in new issue
Block a user