feat(render): add auto header
This commit is contained in:
parent
fd9c3bd19d
commit
b7768b1b3c
6 changed files with 50 additions and 26 deletions
|
|
@ -52,6 +52,10 @@ export function appendTo (target, el) {
|
|||
return target.appendChild(el)
|
||||
}
|
||||
|
||||
export function before (target, el) {
|
||||
return target.insertBefore(el, target.children[0])
|
||||
}
|
||||
|
||||
export function on (el, type, handler) {
|
||||
isFn(type)
|
||||
? window.addEventListener(el, type)
|
||||
|
|
@ -72,5 +76,5 @@ export const off = function on (el, type, handler) {
|
|||
* toggleClass(el, 'add', 'active') => el.classList.add('active')
|
||||
*/
|
||||
export function toggleClass (el, type, val) {
|
||||
el.classList[val ? type : 'toggle'](val || type)
|
||||
el && el.classList[val ? type : 'toggle'](val || type)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue