From a86f0c77d8e33f2452ede81aaf574a506be8ebb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=A7=89?= Date: Wed, 4 Oct 2023 06:14:38 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A7=BB=E9=99=A4=E7=A9=BA=E7=9A=84class?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/weigets.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/weigets.js b/public/weigets.js index c6f696b..14f5564 100644 --- a/public/weigets.js +++ b/public/weigets.js @@ -3,7 +3,7 @@ export function createElement({ innerText, textContent, onclick, children = [], for (const key in attributes) { element.setAttribute(key, attributes[key]) } - element.classList.add(...classList) + if (classList.length) element.classList.add(...classList) if (innerText) element.innerText = innerText if (textContent) element.textContent = textContent if (onclick) element.onclick = onclick