diff --git a/index.js b/index.js index 767d676..261c103 100644 --- a/index.js +++ b/index.js @@ -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('是什么, 为什么, 怎么做?'), diff --git a/main.js b/main.js index a659875..283e0cb 100644 --- a/main.js +++ b/main.js @@ -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 }