mirror of
https://github.com/yewprint/yewprint
synced 2024-11-25 13:00:19 +00:00
Partially resolve performance issue
This commit is contained in:
parent
95763ad1e7
commit
846c3896f5
1 changed files with 8 additions and 4 deletions
12
src/app.rs
12
src/app.rs
|
@ -17,6 +17,8 @@ pub struct App {
|
|||
dark_theme: bool,
|
||||
collapsed: bool,
|
||||
tree: TreeData<i32>,
|
||||
callback_expand_node: Callback<(NodeId, MouseEvent)>,
|
||||
callback_select_node: Callback<(NodeId, MouseEvent)>,
|
||||
}
|
||||
|
||||
pub enum Msg {
|
||||
|
@ -94,11 +96,13 @@ impl Component for App {
|
|||
.unwrap();
|
||||
|
||||
App {
|
||||
link,
|
||||
counter: 0,
|
||||
dark_theme: true,
|
||||
collapsed: true,
|
||||
tree: tree.into(),
|
||||
callback_expand_node: link.callback(|(node_id, _)| Msg::ExpandNode(node_id)),
|
||||
callback_select_node: link.callback(|(node_id, _)| Msg::SelectNode(node_id)),
|
||||
link,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -186,9 +190,9 @@ impl Component for App {
|
|||
<div>
|
||||
<Tree<i32>
|
||||
tree=self.tree.clone()
|
||||
on_collapse=Some(self.link.callback(|(node_id, _)| Msg::ExpandNode(node_id)))
|
||||
on_expand=Some(self.link.callback(|(node_id, _)| Msg::ExpandNode(node_id)))
|
||||
onclick=Some(self.link.callback(|(node_id, _)| Msg::SelectNode(node_id)))
|
||||
on_collapse=Some(self.callback_expand_node.clone())
|
||||
on_expand=Some(self.callback_expand_node.clone())
|
||||
onclick=Some(self.callback_select_node.clone())
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Reference in a new issue