spread.rs 821 B

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