Add custom data attribute support
This commit is contained in:
parent
43b3236d3b
commit
bc7a659303
1 changed files with 4 additions and 0 deletions
|
|
@ -90,6 +90,10 @@ impl Element {
|
||||||
self.attr(name, "")
|
self.attr(name, "")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn data(self, name: impl ToString, value: impl ToString) -> Self {
|
||||||
|
self.attr(format!("data-{}", name.to_string()), value)
|
||||||
|
}
|
||||||
|
|
||||||
pub fn child(mut self, child: impl Into<Content>) -> Self {
|
pub fn child(mut self, child: impl Into<Content>) -> Self {
|
||||||
self.children.push(child.into());
|
self.children.push(child.into());
|
||||||
self
|
self
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue