@@ -145,7 +145,7 @@ fn success_level(clicks: i32) -> El<Msg> {
145145}
146146
147147/// The top-level component we pass to the virtual dom.
148- fn view (model : & Model ) -> El <Msg > {
148+ fn view (model : & Model ) -> Vec < El <Msg > > {
149149 let plural = if model . count == 1 {"" } else {" s" };
150150
151151 // Attrs, Style, Events, and children may be defined separately.
@@ -155,27 +155,29 @@ fn view(model: &Model) -> El<Msg> {
155155 " text-align" => " center"
156156 };
157157
158- div! [ outer_style ,
159- h1! [ " The Grand Total" ],
160- div! [
161- style! {
162- // Example of conditional logic in a style.
163- " color" => if model . count > 4 {" purple" } else {" gray" };
164- // When passing numerical values to style!, "px" is implied.
165- " border" => " 2px solid #004422" ; " padding" => 20
166- },
167- // We can use normal Rust code and comments in the view.
168- h3! [ format! (" {} {}{} so far" , model . count, model . what_we_count, plural ) ],
169- button! [ simple_ev (Ev :: Click , Msg :: Increment ), " +" ],
170- button! [ simple_ev (Ev :: Click , Msg :: Decrement ), " -" ],
171-
172- // Optionally-displaying an element
173- if model . count >= 10 { h2! [ style! {" padding" => 50 }, " Nice!" ] } else { seed :: empty () }
174- ],
175- success_level (model . count), // Incorporating a separate component
176-
177- h3! [ " What precisely is it we're counting?" ],
178- input! [ attrs! {At :: Value => model . what_we_count}, input_ev (Ev :: Input , Msg :: ChangeWWC ) ]
158+ vec! [
159+ div! [ outer_style ,
160+ h1! [ " The Grand Total" ],
161+ div! [
162+ style! {
163+ // Example of conditional logic in a style.
164+ " color" => if model . count > 4 {" purple" } else {" gray" };
165+ // When passing numerical values to style!, "px" is implied.
166+ " border" => " 2px solid #004422" ; " padding" => 20
167+ },
168+ // We can use normal Rust code and comments in the view.
169+ h3! [ format! (" {} {}{} so far" , model . count, model . what_we_count, plural ) ],
170+ button! [ simple_ev (Ev :: Click , Msg :: Increment ), " +" ],
171+ button! [ simple_ev (Ev :: Click , Msg :: Decrement ), " -" ],
172+
173+ // Optionally-displaying an element
174+ if model . count >= 10 { h2! [ style! {" padding" => 50 }, " Nice!" ] } else { seed :: empty () }
175+ ],
176+ success_level (model . count), // Incorporating a separate component
177+
178+ h3! [ " What precisely is it we're counting?" ],
179+ input! [ attrs! {At :: Value => model . what_we_count}, input_ev (Ev :: Input , Msg :: ChangeWWC ) ]
180+ ]
179181 ]
180182}
181183
0 commit comments