2024-01-15 21:12:44 -08:00
|
|
|
use dioxus::prelude::*;
|
2023-09-20 16:15:11 -05:00
|
|
|
|
|
|
|
fn main() {
|
2024-01-15 21:12:44 -08:00
|
|
|
let mut dom = VirtualDom::prebuilt(app);
|
2023-09-22 09:24:00 -05:00
|
|
|
let html = dioxus_ssr::render(&dom);
|
|
|
|
|
|
|
|
println!("{}", html);
|
2023-09-20 16:15:11 -05:00
|
|
|
}
|
|
|
|
|
2024-01-13 20:51:37 -08:00
|
|
|
fn app() -> Element {
|
2024-01-16 13:18:46 -06:00
|
|
|
rsx! {
|
2024-01-16 11:04:37 -06:00
|
|
|
spreadable_component {
|
2023-09-26 19:23:00 -05:00
|
|
|
width: "10px",
|
2023-09-27 10:05:02 -05:00
|
|
|
extra_data: "hello{1}",
|
|
|
|
extra_data2: "hello{2}",
|
2023-09-26 19:23:00 -05:00
|
|
|
height: "10px",
|
2024-01-06 08:58:49 -06:00
|
|
|
left: 1
|
2023-09-26 19:23:00 -05:00
|
|
|
}
|
2023-09-20 16:15:11 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-01-16 11:04:37 -06:00
|
|
|
fn spreadable_component(props: Props) -> Element {
|
2024-01-16 13:18:46 -06:00
|
|
|
rsx! {
|
2024-01-14 15:21:19 -06:00
|
|
|
audio { ..props.attributes, "1: {props.extra_data}\n2: {props.extra_data2}" }
|
2023-09-22 09:24:00 -05:00
|
|
|
}
|
2023-09-20 16:15:11 -05:00
|
|
|
}
|
2023-09-26 19:23:00 -05:00
|
|
|
|
2024-01-14 15:21:19 -06:00
|
|
|
#[derive(Props, PartialEq, Clone)]
|
|
|
|
struct Props {
|
2023-09-26 19:23:00 -05:00
|
|
|
#[props(extends = GlobalAttributes)]
|
2024-01-14 15:21:19 -06:00
|
|
|
attributes: Vec<Attribute>,
|
2024-01-15 17:04:39 -08:00
|
|
|
|
2024-01-14 15:21:19 -06:00
|
|
|
extra_data: String,
|
|
|
|
extra_data2: String,
|
2023-09-26 19:23:00 -05:00
|
|
|
}
|