spread.rs 629 B

12345678910111213141516171819202122232425262728293031323334
  1. use dioxus::prelude::*;
  2. fn main() {
  3. let mut dom = VirtualDom::new(app);
  4. let _ = dom.rebuild();
  5. let html = dioxus_ssr::render(&dom);
  6. println!("{}", html);
  7. }
  8. fn app(cx: Scope) -> Element {
  9. render! {
  10. Component {
  11. width: "10px",
  12. height: "10px",
  13. left: 1,
  14. }
  15. }
  16. }
  17. fn Component<'a>(cx: Scope<'a, Props<'a>>) -> Element<'a> {
  18. let attributes = &*cx.props.attributes;
  19. render! {
  20. audio {
  21. ..attributes,
  22. }
  23. }
  24. }
  25. #[derive(Props)]
  26. struct Props<'a> {
  27. #[props(extends = GlobalAttributes)]
  28. attributes: Vec<Attribute<'a>>,
  29. }