#[component(Backend = DomBackend, SlotData = String)]
struct MyChild {
template: template! {
<div> "This line is in the child component." </div>
<slot data=&{ self.my_string_data } />
},
my_string_data: String,
}
impl Component for MyChild {
fn new() -> Self {
Self {
template: Default::default(),
my_string_data: "slot data".to_string(),
}
}
}
#[component(Backend = DomBackend)]
struct MyWebsite {
template: template! {
<MyChild slot:sd>
<div> { sd } </div>
</_>
}
}
impl Component for MyWebsite {
fn new() -> Self {
Self {
template: Default::default(),
}
}
}