Fix eventhandler optional (#2119)
This commit is contained in:
1 parent
9f283f571f
commit
44e997f7df
2 files changed
+13
-3
No files matched your search
@@ -24,9 +24,7 @@ enum Route {
|
|||||||
|
|
||||||
#[component]
|
#[component]
|
||||||
fn Homepage() -> Element {
|
fn Homepage() -> Element {
|
||||||
rsx! {
|
rsx! { h1 { "Welcome home" } }
|
||||||
h1 { "Welcome home" }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[component]
|
#[component]
|
||||||
@@ -52,6 +50,7 @@ fn Nav() -> Element {
|
|||||||
to: Route::Blog {
|
to: Route::Blog {
|
||||||
id: "Brownies".to_string(),
|
id: "Brownies".to_string(),
|
||||||
},
|
},
|
||||||
|
onclick: move |_| { println!("Clicked on Brownies") },
|
||||||
"Learn Brownies"
|
"Learn Brownies"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -170,6 +170,17 @@ impl<'a> SuperFrom<Arguments<'a>, OptionArgumentsFromMarker> for Option<String>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[doc(hidden)]
|
||||||
|
pub struct OptionHandlerMarker;
|
||||||
|
|
||||||
|
impl<G: 'static, F: FnMut(G) + 'static> SuperFrom<F, OptionHandlerMarker>
|
||||||
|
for Option<EventHandler<G>>
|
||||||
|
{
|
||||||
|
fn super_from(input: F) -> Self {
|
||||||
|
Some(EventHandler::new(input))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[allow(unused)]
|
#[allow(unused)]
|
||||||
fn from_props_compiles() {
|
fn from_props_compiles() {
|
||||||
|
|||||||
Reference in new issue
Block a user