Struct yew::virtual_dom::VTag
source · pub struct VTag {
pub node_ref: NodeRef,
pub attributes: Attributes,
pub key: Option<Key>,
/* private fields */
}
Expand description
A type for a virtual Element representation.
Fields§
§node_ref: NodeRef
A node reference used for DOM access in Component lifecycle methods
attributes: Attributes
List of attributes.
key: Option<Key>
Implementations§
source§impl VTag
impl VTag
sourcepub fn new(tag: impl Into<Cow<'static, str>>) -> Self
pub fn new(tag: impl Into<Cow<'static, str>>) -> Self
Creates a new VTag instance with tag
name (cannot be changed later in DOM).
sourcepub fn add_children(&mut self, children: impl IntoIterator<Item = VNode>)
pub fn add_children(&mut self, children: impl IntoIterator<Item = VNode>)
Add multiple VNode children.
sourcepub fn children(&self) -> Option<&VNode>
pub fn children(&self) -> Option<&VNode>
Returns a reference to the children of this VTag, if the node can have children
sourcepub fn children_mut(&mut self) -> Option<&mut VNode>
pub fn children_mut(&mut self) -> Option<&mut VNode>
Returns a mutable reference to the children of this VTag, if the node can have children
sourcepub fn into_children(self) -> Option<VNode>
pub fn into_children(self) -> Option<VNode>
Returns the children of this VTag, if the node can have children
sourcepub fn set_value(&mut self, value: impl IntoPropValue<Option<AttrValue>>)
pub fn set_value(&mut self, value: impl IntoPropValue<Option<AttrValue>>)
Sets value
for an
InputElement or
TextArea
sourcepub fn checked(&self) -> Option<bool>
pub fn checked(&self) -> Option<bool>
Returns checked
property of an
InputElement.
(Does not affect the value of the node’s attribute).
sourcepub fn set_checked(&mut self, value: bool)
pub fn set_checked(&mut self, value: bool)
Sets checked
property of an
InputElement.
(Does not affect the value of the node’s attribute).
sourcepub fn preserve_checked(&mut self)
pub fn preserve_checked(&mut self)
Keeps the current value of the checked
property of an
InputElement.
(Does not affect the value of the node’s attribute).
sourcepub fn add_attribute(&mut self, key: &'static str, value: impl Into<AttrValue>)
pub fn add_attribute(&mut self, key: &'static str, value: impl Into<AttrValue>)
Adds a key-value pair to attributes
Not every attribute works when it set as an attribute. We use workarounds for:
value
and checked
.
sourcepub fn add_property(&mut self, key: &'static str, value: impl Into<AttrValue>)
pub fn add_property(&mut self, key: &'static str, value: impl Into<AttrValue>)
Set the given key as property on the element
js_sys::Reflect
is used for setting properties.
sourcepub fn set_attributes(&mut self, attrs: impl Into<Attributes>)
pub fn set_attributes(&mut self, attrs: impl Into<Attributes>)
Sets attributes to a virtual node.
Not every attribute works when it set as an attribute. We use workarounds for:
value
and checked
.
sourcepub fn add_listener(&mut self, listener: Rc<dyn Listener>) -> bool
pub fn add_listener(&mut self, listener: Rc<dyn Listener>) -> bool
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for VTag
impl !Send for VTag
impl !Sync for VTag
impl Unpin for VTag
impl !UnwindSafe for VTag
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
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoPropValue<Option<T>> for T
impl<T> IntoPropValue<Option<T>> for T
source§fn into_prop_value(self) -> Option<T>
fn into_prop_value(self) -> Option<T>
self
to a value of a Properties
struct.source§impl<T> IntoPropValue<T> for T
impl<T> IntoPropValue<T> for T
source§fn into_prop_value(self) -> T
fn into_prop_value(self) -> T
self
to a value of a Properties
struct.