简写合并代码
This commit is contained in:
parent
4b82c1afde
commit
3ad79bc529
1
index.js
1
index.js
@ -8,7 +8,6 @@ document.body.appendChild(div.absolute.t_2.r_2.bg_red_500.childs([
|
|||||||
div.text('会话/账户')
|
div.text('会话/账户')
|
||||||
]))
|
]))
|
||||||
|
|
||||||
// cursor-pointer overflow-clip hover:text-pink-500
|
|
||||||
document.body.appendChild(div.cursor_pointer.bg_red_500.overflow_clip.w_1000.childs([
|
document.body.appendChild(div.cursor_pointer.bg_red_500.overflow_clip.w_1000.childs([
|
||||||
h1.m_2rem.pt_2rem.text('Widgets!'),
|
h1.m_2rem.pt_2rem.text('Widgets!'),
|
||||||
p.m('1rem').p({ top: '1rem' }).text('是什么, 为什么, 怎么做?'),
|
p.m('1rem').p({ top: '1rem' }).text('是什么, 为什么, 怎么做?'),
|
||||||
|
17
main.js
17
main.js
@ -95,24 +95,17 @@ export function createElement({ innerText, innerHTML, textContent, readOnly, chi
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (key === 'justify') {
|
if (key === 'justify') {
|
||||||
if (value === 'center') {
|
if (['start', 'end', 'center', 'between', 'around'].includes(value)) {
|
||||||
element.style.justifyContent = 'center'
|
element.style.justifyContent = `flex-${value}`
|
||||||
return
|
|
||||||
}
|
|
||||||
if (value === 'end') {
|
|
||||||
element.style.justifyContent = 'flex-end'
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if (key === 'font') {
|
if (key === 'font') {
|
||||||
if (value === 'bold') {
|
if (['bold', 'semibold'].includes(value)) {
|
||||||
element.style.fontWeight = value
|
const fontWeightMap = { 'semibold': 600, 'bold': 700 }
|
||||||
return
|
element.style.fontWeight = fontWeightMap[value]
|
||||||
}
|
|
||||||
if (value === 'semibold') {
|
|
||||||
element.style.fontWeight = 600
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user