combo.new.rsx 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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 {
  13. circle {
  14. cx: 50,
  15. cy: 50,
  16. r: 40,
  17. stroke: "green",
  18. fill: "yellow"
  19. }
  20. }
  21. div {
  22. class: "raw-attribute-div",
  23. "raw-attribute": "raw-attribute-value"
  24. }
  25. div { class: "hidden-attribute-div", hidden: true }
  26. div {
  27. class: "dangerous-inner-html-div",
  28. dangerous_inner_html: "<p>hello dangerous inner html</p>"
  29. }
  30. input { value: "hello input" }
  31. div { class: "style-div", color: "red", "colored text" }
  32. div { class: "style-div", color: "red", "colored text" }
  33. button {
  34. class: "eval-button",
  35. onclick: move |_| async move {
  36. let mut eval = eval(
  37. r#"
  38. window.document.title = 'Hello from Dioxus Eval!';
  39. dioxus.send("returned eval value");
  40. "#,
  41. );
  42. let result = eval.recv().await;
  43. if let Ok(serde_json::Value::String(string)) = result {
  44. eval_result.set(string);
  45. }
  46. },
  47. "Eval!!!!"
  48. "Eval!!!!"
  49. "Eval!!!!!"
  50. "Eval!!!!"
  51. "Eval!!!!"
  52. "Eval!!!!"
  53. }
  54. div { class: "eval-result", "{eval_result}" }
  55. }
  56. }
  57. fn main() {
  58. // tracing_wasm::set_as_global_default_with_config(
  59. // tracing_wasm::WASMLayerConfigBuilder::default()
  60. // .set_max_level(tracing::Level::TRACE)
  61. // .build(),
  62. // );
  63. launch(app);
  64. }