MCPcopy Create free account
hub / github.com/Apress/practical-rust-web-projects / view

Method view

Ch06/yew-image-processing/src/app.rs:102–123  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

100 }
101
102 fn view(&self) -> Html {
103 html! {
104 <div>
105 <input type="file" name="image-upload" id="image-upload" value="" onchange=self.link.callback(move |value| {
106 let mut result = Vec::new();
107 if let ChangeData::Files(files) = value {
108 let files = js_sys::try_iter(&files)
109 .unwrap()
110 .unwrap()
111 .into_iter()
112 .map(|v| File::from(v.unwrap()));
113 result.extend(files);
114 }
115 Msg::LoadFile(result)
116 }) />
117 <br />
118 <button id="shrink" onclick=self.link.callback(move |_| { Msg::Shrink })>{ "Shrink" }</button>
119 <br / >
120 <canvas id="preview"></canvas>
121 </div>
122 }
123 }
124}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected