Enum leptos_dom::View
source · pub enum View {
Element(Element),
Text(Text),
Component(ComponentRepr),
CoreComponent(CoreComponent),
Transparent(Transparent),
Suspense(HydrationKey, CoreComponent),
}
Expand description
A leptos view which can be mounted to the DOM.
Variants§
Element(Element)
HTML element node.
Text(Text)
HTML text node.
Component(ComponentRepr)
Custom leptos component.
CoreComponent(CoreComponent)
leptos core-component.
Transparent(Transparent)
Wraps arbitrary data that’s not part of the view but is passed via the view tree.
Suspense(HydrationKey, CoreComponent)
Marks the contents of Suspense component, which can be replaced in streaming SSR.
Implementations§
source§impl View
impl View
sourcepub fn render_to_string(self, _cx: Scope) -> Cow<'static, str>
pub fn render_to_string(self, _cx: Scope) -> Cow<'static, str>
Consumes the node and renders it into an HTML string.
source§impl View
impl View
sourcepub fn into_stream_chunks(self, cx: Scope) -> Vec<StreamChunk>
pub fn into_stream_chunks(self, cx: Scope) -> Vec<StreamChunk>
Renders the view into a set of HTML chunks that can be streamed.
source§impl View
impl View
sourcepub fn as_element(&self) -> Option<&Element>
pub fn as_element(&self) -> Option<&Element>
sourcepub fn as_transparent(&self) -> Option<&Transparent>
pub fn as_transparent(&self) -> Option<&Transparent>
Returns Some
Transparent
if the view is of this type. None
otherwise.
sourcepub fn into_html_element(
self,
cx: Scope
) -> Result<HtmlElement<AnyElement>, Self>
pub fn into_html_element( self, cx: Scope ) -> Result<HtmlElement<AnyElement>, Self>
sourcepub fn on<E: EventDescriptor + 'static>(
self,
event: E,
event_handler: impl FnMut(E::EventType) + 'static
) -> Self
pub fn on<E: EventDescriptor + 'static>( self, event: E, event_handler: impl FnMut(E::EventType) + 'static ) -> Self
Adds an event listener, analogous to HtmlElement::on
.
This method will attach an event listener to all child
HtmlElement
children.
Trait Implementations§
source§impl FromIterator<View> for Fragment
impl FromIterator<View> for Fragment
source§impl PartialEq<View> for View
impl PartialEq<View> for View
impl Eq for View
impl StructuralEq for View
impl StructuralPartialEq for View
Auto Trait Implementations§
impl !RefUnwindSafe for View
impl !Send for View
impl !Sync for View
impl Unpin for View
impl !UnwindSafe for View
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.