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, "")
|
||||
}
|
||||
|
||||
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 {
|
||||
self.children.push(child.into());
|
||||
self
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue