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_mut(&mut self) -> Option<&mut VList>
pub fn children_mut(&mut self) -> Option<&mut VList>
Returns a mutable reference to the children of this VTag, if the node can have children
sourcepub fn into_children(self) -> VList
pub fn into_children(self) -> VList
Returns the children of this VTag
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
.