mirror of
https://github.com/DioxusLabs/dioxus
synced 2024-11-14 16:37:14 +00:00
37 lines
776 B
Rust
37 lines
776 B
Rust
use dioxus::{core::NoOpMutations, prelude::*};
|
|
|
|
fn main() {
|
|
let mut dom = VirtualDom::new(app);
|
|
let _ = dom.rebuild(&mut NoOpMutations);
|
|
let html = dioxus_ssr::render(&dom);
|
|
|
|
println!("{}", html);
|
|
}
|
|
|
|
fn app() -> Element {
|
|
render! {
|
|
Component {
|
|
width: "10px",
|
|
extra_data: "hello{1}",
|
|
extra_data2: "hello{2}",
|
|
height: "10px",
|
|
left: 1
|
|
}
|
|
}
|
|
}
|
|
|
|
#[component]
|
|
fn Component(props: Props) -> Element {
|
|
render! {
|
|
audio { ..props.attributes, "1: {props.extra_data}\n2: {props.extra_data2}" }
|
|
}
|
|
}
|
|
|
|
#[derive(Props, PartialEq, Clone)]
|
|
struct Props {
|
|
#[props(extends = GlobalAttributes)]
|
|
attributes: Vec<Attribute>,
|
|
|
|
extra_data: String,
|
|
extra_data2: String,
|
|
}
|