Browse Source

fix readme expanded example

Evan Almloff 1 năm trước cách đây
mục cha
commit
cbf8a1e158
1 tập tin đã thay đổi với 7 bổ sung9 xóa
  1. 7 9
      docs/guide/examples/readme_expanded.rs

+ 7 - 9
docs/guide/examples/readme_expanded.rs

@@ -84,24 +84,22 @@ fn app(cx: Scope) -> Element {
                     ],
                 };
                 // The VNode is a reference to the template with the dynamic parts of the rsx
-                ::dioxus::core::VNode {
-                    parent: Default::default(),
-                    key: None,
+                ::dioxus::core::VNode::new(
+                    None,
                     // The static template this node will use. The template is stored in a Cell so it can be replaced with a new template when hot rsx reloading is enabled
-                    template: std::cell::Cell::new(TEMPLATE),
-                    root_ids: dioxus::core::exports::bumpalo::collections::Vec::new_in(__cx.bump())
-                        .into(),
-                    dynamic_nodes: __cx.bump().alloc([
+                    TEMPLATE,
+                    dioxus::core::exports::bumpalo::collections::Vec::new_in(__cx.bump()),
+                    __cx.bump().alloc([
                         // The dynamic count text node (dynamic node id 0)
                         __cx.text_node(format_args!("High-Five counter: {0}", count)),
                     ]),
-                    dynamic_attrs: __cx.bump().alloc([
+                    __cx.bump().alloc([
                         // The dynamic up high button onclick listener (dynamic attribute id 0)
                         dioxus_elements::events::onclick(__cx, move |_| count += 1),
                         // The dynamic down low button onclick listener (dynamic attribute id 1)
                         dioxus_elements::events::onclick(__cx, move |_| count -= 1),
                     ]),
-                }
+                )
             },
         ),
     )