默认组件为div
This commit is contained in:
parent
ff2f6c7e3c
commit
cdb2261773
@ -1,4 +1,4 @@
|
|||||||
export function createElement({ innerText, textContent, onclick, children = [], dataset, classList = [], ...attributes }, tagName) {
|
export function createElement({ innerText, textContent, onclick, children = [], dataset, classList = [], ...attributes }, tagName = 'div') {
|
||||||
const element = document.createElement(tagName)
|
const element = document.createElement(tagName)
|
||||||
for (const key in attributes) {
|
for (const key in attributes) {
|
||||||
element.setAttribute(key, attributes[key])
|
element.setAttribute(key, attributes[key])
|
||||||
|
Loading…
Reference in New Issue
Block a user