combo.old.rsx 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. // This test is used by playwright configured in the root of the repo
  2. use dioxus::prelude::*;
  3. fn app() -> Element {
  4. let mut num = use_signal(|| 0);
  5. let mut eval_result = use_signal(String::new);
  6. let a = 123;
  7. rsx! {
  8. div {
  9. "hello axum! {num}"
  10. button { class: "increment-button", onclick: move |_| num += 1, "Increment" }
  11. }
  12. svg { circle { cx: 50, cy: 50, r: 40, stroke: "green", fill: "yellow" } }
  13. div { class: "raw-attribute-div", "raw-attribute": "raw-attribute-value" }
  14. div { class: "hidden-attribute-div", hidden: true }
  15. div {
  16. class: "dangerous-inner-html-div",
  17. dangerous_inner_html: "<p>hello dangerous inner html</p>"
  18. }
  19. input { value: "hello input" }
  20. div { class: "style-div", color: "red", "colored text" }
  21. div { class: "style-div", color: "red", "colored text" }
  22. button {
  23. class: "eval-button",
  24. onclick: move |_| async move {
  25. let mut eval = eval(
  26. r#"
  27. window.document.title = 'Hello from Dioxus Eval!';
  28. dioxus.send("returned eval value");
  29. "#,
  30. );
  31. let result = eval.recv().await;
  32. if let Ok(serde_json::Value::String(string)) = result {
  33. eval_result.set(string);
  34. }
  35. },
  36. "Eval!!!!"
  37. "Eval!!!!"
  38. "Eval!!!!!"
  39. "Eval!!!!"
  40. "Eval!!!!"
  41. }
  42. div { class: "eval-result", "{eval_result}" }
  43. }
  44. }
  45. fn main() {
  46. // tracing_wasm::set_as_global_default_with_config(
  47. // tracing_wasm::WASMLayerConfigBuilder::default()
  48. // .set_max_level(tracing::Level::TRACE)
  49. // .build(),
  50. // );
  51. dioxus::launch(app);
  52. }