fix: calculator example

This commit is contained in:
YuKun Liu 2022-01-07 07:36:22 +08:00
parent 859be4a2f6
commit db5b1e1916

View file

@ -18,7 +18,7 @@ fn main() {
});
}
fn clac_val(val: String) -> f64 {
fn calc_val(val: String) -> f64 {
let mut result = 0.0_f64;
let mut temp = String::new();
@ -124,7 +124,7 @@ fn app(cx: Scope) -> Element {
button {
class: "calculator-key key-percent",
onclick: move |_| {
cur_val.set(clac_val(display_value.get().clone()) / 100.0);
cur_val.set(calc_val(display_value.get().clone()) / 100.0);
},
"%"
}
@ -165,7 +165,7 @@ fn app(cx: Scope) -> Element {
}
button { class: "calculator-key key-equals",
onclick: move |_| {
cur_val.set(clac_val(display_value.get().clone()));
cur_val.set(calc_val(display_value.get().clone()));
},
"="
}