Methods
# static addClass(el, name)
给当前节点添加一个className
Parameters:
| Name | Type | Description |
|---|---|---|
el |
string
|
节点 |
name |
string
|
类名 |
# static create(dom, className, container) → {Node}
创建dom
Parameters:
| Name | Type | Description |
|---|---|---|
dom |
string
|
dom标签 |
className |
string
|
类名 |
container |
string
|
包裹的容器 |
- 创建的dom
Node
# static createSvg(width, height, path, container) → {SVGElement}
创建一个svg
Parameters:
| Name | Type | Description |
|---|---|---|
width |
string
|
宽 |
height |
string
|
高 |
path |
string
|
svg化的路径 |
container |
string
|
插入svg的节点 |
- svg
SVGElement
# static createVideo(url, className, container) → {Node}
创建video标签
Parameters:
| Name | Type | Description |
|---|---|---|
url |
string
|
音视频路径 |
className |
string
|
class名称 |
container |
string
|
要加入的容器 |
- 返回创建的video结构
Node
# static get(id) → {Node}
通过id获取当前dom元素
Parameters:
| Name | Type | Description |
|---|---|---|
id |
string
|
元素的id |
- 如果dom结构是字符串,则返回dom,否则原路返回
Node
# static getStyle(el, style) → {null|*}
返回元素上某个样式属性的值,包括计算值或通过CSS设置的值。
Parameters:
| Name | Type | Description |
|---|---|---|
el |
string
|
节点 |
style |
string
|
样式的key值 |
null
|
*
# static parseDom(domStr, withWrapper, className) → {HTMLDivElement|NodeListOf.<ChildNode>}
将字符串转译成Element
Parameters:
| Name | Type | Description |
|---|---|---|
domStr |
string
|
需要转义的字符串 |
withWrapper |
string
|
是否给外层包一个元素 |
className |
string
|
类名 |
HTMLDivElement
|
NodeListOf.<ChildNode>
# static removeClass(el, name)
将指定类名从节点删除
Parameters:
| Name | Type | Description |
|---|---|---|
el |
string
|
节点 |
name |
string
|
类名 |