简写合并代码

This commit is contained in:
satori 2024-09-06 01:35:45 +08:00
parent 4b82c1afde
commit 3ad79bc529
2 changed files with 5 additions and 13 deletions

View File

@ -8,7 +8,6 @@ document.body.appendChild(div.absolute.t_2.r_2.bg_red_500.childs([
div.text('会话/账户')
]))
// cursor-pointer overflow-clip hover:text-pink-500
document.body.appendChild(div.cursor_pointer.bg_red_500.overflow_clip.w_1000.childs([
h1.m_2rem.pt_2rem.text('Widgets!'),
p.m('1rem').p({ top: '1rem' }).text('是什么, 为什么, 怎么做?'),

17
main.js
View File

@ -95,24 +95,17 @@ export function createElement({ innerText, innerHTML, textContent, readOnly, chi
}
if (key === 'justify') {
if (value === 'center') {
element.style.justifyContent = 'center'
return
}
if (value === 'end') {
element.style.justifyContent = 'flex-end'
if (['start', 'end', 'center', 'between', 'around'].includes(value)) {
element.style.justifyContent = `flex-${value}`
return
}
return
}
if (key === 'font') {
if (value === 'bold') {
element.style.fontWeight = value
return
}
if (value === 'semibold') {
element.style.fontWeight = 600
if (['bold', 'semibold'].includes(value)) {
const fontWeightMap = { 'semibold': 600, 'bold': 700 }
element.style.fontWeight = fontWeightMap[value]
return
}