mirror of
https://github.com/yewstack/yew.git
synced 2025-12-08 21:26:25 +00:00
implement html from Option<VNode> (#2792)
Co-authored-by: Martin Molzer <WorldSEnder@users.noreply.github.com>
This commit is contained in:
parent
8eb9b5a4dc
commit
81f7ea482b
@ -121,6 +121,9 @@ fn compile_pass() {
|
||||
|
||||
// test for https://github.com/yewstack/yew/issues/2810
|
||||
::yew::html! { <div data-type="date" data-as="calender" /> };
|
||||
|
||||
let option_vnode = ::std::option::Option::Some(::yew::html! {});
|
||||
::yew::html! { <div>{option_vnode}</div> };
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
||||
@ -23,6 +23,15 @@ impl<IN: Into<OUT>, OUT> From<IN> for NodeSeq<IN, OUT> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<IN: Into<OUT>, OUT> From<Option<IN>> for NodeSeq<IN, OUT> {
|
||||
fn from(val: Option<IN>) -> Self {
|
||||
Self(
|
||||
val.map(|s| vec![s.into()]).unwrap_or_default(),
|
||||
PhantomData::default(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
impl<IN: Into<OUT>, OUT> From<Vec<IN>> for NodeSeq<IN, OUT> {
|
||||
fn from(val: Vec<IN>) -> Self {
|
||||
Self(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user