2022-01-01 14:49:08 +00:00
|
|
|
use dioxus::prelude::*;
|
|
|
|
|
|
|
|
fn main() {
|
2022-07-09 19:15:20 +00:00
|
|
|
dioxus_tui::launch(app);
|
2022-01-01 14:49:08 +00:00
|
|
|
}
|
|
|
|
|
2024-01-14 04:51:37 +00:00
|
|
|
fn app() -> Element {
|
2024-01-19 22:19:49 +00:00
|
|
|
let mut count = use_signal(|| 0);
|
2022-01-01 14:49:08 +00:00
|
|
|
|
2024-01-19 22:19:49 +00:00
|
|
|
use_future(move || async move {
|
|
|
|
loop {
|
|
|
|
count += 1;
|
|
|
|
tokio::time::sleep(std::time::Duration::from_millis(1000)).await;
|
|
|
|
schedule_update();
|
2022-01-01 14:49:08 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2024-01-14 05:12:21 +00:00
|
|
|
rsx! {
|
2022-01-01 14:49:08 +00:00
|
|
|
div { width: "100%",
|
|
|
|
div { width: "50%", height: "5px", background_color: "blue", justify_content: "center", align_items: "center",
|
|
|
|
"Hello {count}!"
|
|
|
|
}
|
|
|
|
div { width: "50%", height: "10px", background_color: "red", justify_content: "center", align_items: "center",
|
|
|
|
"Hello {count}!"
|
|
|
|
}
|
|
|
|
}
|
2024-01-14 05:12:21 +00:00
|
|
|
}
|
2022-01-01 14:49:08 +00:00
|
|
|
}
|