feat: improve safety
This commit is contained in:
1 parent
601078f9cf
commit
fda2ebc2a2
12 files changed
+113
-36
No files matched your search
@@ -1,3 +1,5 @@
|
||||
#![allow(non_snake_case)]
|
||||
|
||||
use dioxus::component::Component;
|
||||
use dioxus::events::on::MouseEvent;
|
||||
use dioxus_core as dioxus;
|
||||
@@ -13,7 +15,7 @@ fn main() {
|
||||
assert!(g.edits.len() > 1);
|
||||
}
|
||||
|
||||
static App: FC<()> = |(cx, props)| {
|
||||
fn App((cx, props): Component<()>) -> DomTree {
|
||||
let mut rng = SmallRng::from_entropy();
|
||||
let rows = (0..10_000_usize).map(|f| {
|
||||
let label = Label::new(&mut rng);
|
||||
@@ -31,13 +33,14 @@ static App: FC<()> = |(cx, props)| {
|
||||
}
|
||||
}
|
||||
})
|
||||
};
|
||||
}
|
||||
|
||||
#[derive(PartialEq, Props)]
|
||||
struct RowProps {
|
||||
row_id: usize,
|
||||
label: Label,
|
||||
}
|
||||
|
||||
fn Row((cx, props): Component<RowProps>) -> DomTree {
|
||||
let handler = move |evt: MouseEvent| {
|
||||
let g = evt.button;
|
||||
@@ -45,11 +48,11 @@ fn Row((cx, props): Component<RowProps>) -> DomTree {
|
||||
cx.render(rsx! {
|
||||
tr {
|
||||
td { class:"col-md-1", "{props.row_id}" }
|
||||
td { class:"col-md-1", onclick: move |_| { /* run onselect */ }
|
||||
td { class:"col-md-1", on_click: move |_| { /* run onselect */ }
|
||||
a { class: "lbl", "{props.label}" }
|
||||
}
|
||||
td { class: "col-md-1"
|
||||
a { class: "remove", onclick: {handler}
|
||||
a { class: "remove", on_click: {handler}
|
||||
span { class: "glyphicon glyphicon-remove remove" aria_hidden: "true" }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user