spread.rs 713 B

123456789101112131415161718192021222324252627282930313233343536
  1. use dioxus::prelude::*;
  2. fn main() {
  3. let mut dom = VirtualDom::prebuilt(app);
  4. let html = dioxus_ssr::render(&dom);
  5. println!("{}", html);
  6. }
  7. fn app() -> Element {
  8. render! {
  9. Component {
  10. width: "10px",
  11. extra_data: "hello{1}",
  12. extra_data2: "hello{2}",
  13. height: "10px",
  14. left: 1
  15. }
  16. }
  17. }
  18. #[component]
  19. fn Component(props: Props) -> Element {
  20. render! {
  21. audio { ..props.attributes, "1: {props.extra_data}\n2: {props.extra_data2}" }
  22. }
  23. }
  24. #[derive(Props, PartialEq, Clone)]
  25. struct Props {
  26. #[props(extends = GlobalAttributes)]
  27. attributes: Vec<Attribute>,
  28. extra_data: String,
  29. extra_data2: String,
  30. }