feat: flatten props attrs
This commit is contained in:
1 parent
f4132d1874
commit
d2372717bd
4 files changed
+79
-118
No files matched your search
@@ -0,0 +1,37 @@
|
||||
//! Example: README.md showcase
|
||||
//!
|
||||
//! The example from the README.md.
|
||||
|
||||
use dioxus::prelude::*;
|
||||
|
||||
fn main() {
|
||||
dioxus::desktop::launch(app);
|
||||
}
|
||||
|
||||
fn app(cx: Scope) -> Element {
|
||||
cx.render(rsx! {
|
||||
Button {
|
||||
a: "asd".to_string(),
|
||||
c: Some("asd".to_string()),
|
||||
d: "asd".to_string(),
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
#[derive(Props, PartialEq)]
|
||||
struct ButtonProps {
|
||||
a: String,
|
||||
|
||||
#[props(default)]
|
||||
b: Option<String>,
|
||||
|
||||
#[props(default)]
|
||||
c: Option<String>,
|
||||
|
||||
#[props(default)]
|
||||
d: Option<String>,
|
||||
}
|
||||
|
||||
fn Button(cx: Scope<ButtonProps>) -> Element {
|
||||
todo!()
|
||||
}
|
||||
Reference in new issue
Block a user