diff --git a/yewprint-doc/src/checkbox/mod.rs b/yewprint-doc/src/checkbox/mod.rs index 47d28b1..39aad57 100644 --- a/yewprint-doc/src/checkbox/mod.rs +++ b/yewprint-doc/src/checkbox/mod.rs @@ -44,6 +44,7 @@ impl Component for CheckboxDoc { html! {

{"Checkbox"}

+ { + self.value = value; + } + Msg::UpdateValueTwo(value) => { + self.value_two = value; + } } true } @@ -61,6 +69,7 @@ impl Component for Example { bounds=i32::MIN..=i32::MAX increment=10 placeholder=String::from("Enter an integer...") + onchange=self.link.callback(|x| Msg::UpdateValueTwo(x)) /> disabled=self.props.disabled @@ -70,6 +79,7 @@ impl Component for Example { bounds=-10..=10 increment=1 placeholder=String::from("Integer between -10 and 10") + onchange=self.link.callback(|x| Msg::UpdateValue(x)) /> + {format!("actual values are {} and {}", self.value, self.value_two)} } } diff --git a/yewprint-doc/src/numeric_input/mod.rs b/yewprint-doc/src/numeric_input/mod.rs index 8b6d4cb..5821527 100644 --- a/yewprint-doc/src/numeric_input/mod.rs +++ b/yewprint-doc/src/numeric_input/mod.rs @@ -44,6 +44,7 @@ impl Component for NumericInputDoc { html! {

{"NumericInput"}

+
= *self.props.bounds.end() { self.props.value = Some(self.props.bounds.end().clone()); self.input = self.props.bounds.end().to_string(); - true } else { self.props.value = Some(num.clone() + self.props.increment.clone()); self.input = (num + self.props.increment.clone()).to_string(); - true } + self.props.onchange.emit(self.props.value.clone().unwrap()); + true } else { false } @@ -129,12 +130,12 @@ where if num <= *self.props.bounds.start() { self.props.value = Some(self.props.bounds.start().clone()); self.input = self.props.bounds.start().to_string(); - true } else { self.props.value = Some(num.clone() - self.props.increment.clone()); self.input = (num - self.props.increment.clone()).to_string(); - true } + self.props.onchange.emit(self.props.value.clone().unwrap()); + true } else { false }