fix: calculator example
This commit is contained in:
1 parent
db5b1e1916
commit
11172db7f6
1 file changed
+6
-5
@@ -113,11 +113,12 @@ fn app(cx: Scope) -> Element {
|
|||||||
button {
|
button {
|
||||||
class: "calculator-key key-sign",
|
class: "calculator-key key-sign",
|
||||||
onclick: move |_| {
|
onclick: move |_| {
|
||||||
// if display_value.starts_with("-") {
|
let temp = calc_val(display_value.get().clone());
|
||||||
// display_value.set(display_value.trim_start_matches("-").to_string())
|
if temp > 0.0 {
|
||||||
// } else {
|
cur_val.set(temp - (temp * 2.0));
|
||||||
// display_value.set(format!("-{}", *display_value))
|
} else {
|
||||||
// }
|
cur_val.set(temp);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"±"
|
"±"
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user