chore: prettier all tsx codes

This commit is contained in:
陈嘉涵
2020-01-19 17:22:33 +08:00
parent 08c84c9c38
commit f7c5f994dd
9 changed files with 70 additions and 31 deletions
+24 -19
View File
@@ -36,36 +36,41 @@ function NavBar(
slots: NavBarSlots,
ctx: RenderContext<NavBarProps>
) {
function LeftPart() {
if (slots.left) {
return slots.left();
}
return [
props.leftArrow && <Icon class={bem('arrow')} name="arrow-left" />,
props.leftText && <span class={bem('text')}>{props.leftText}</span>,
];
}
function RightPart() {
if (slots.right) {
return slots.right();
}
if (props.rightText) {
return <span class={bem('text')}>{props.rightText}</span>;
}
}
return (
<div
class={[
bem({ fixed: props.fixed }),
{ [BORDER_BOTTOM]: props.border },
]}
style={{ zIndex: props.zIndex }}
class={[bem({ fixed: props.fixed }), { [BORDER_BOTTOM]: props.border }]}
{...inherit(ctx)}
>
<div class={bem('left')} onClick={ctx.listeners['click-left'] || noop}>
{slots.left
? slots.left()
: [
props.leftArrow && (
<Icon class={bem('arrow')} name="arrow-left" />
),
props.leftText && (
<span class={bem('text')}>{props.leftText}</span>
),
]}
{LeftPart()}
</div>
<div class={[bem('title'), 'van-ellipsis']}>
{slots.title ? slots.title() : props.title}
</div>
<div class={bem('right')} onClick={ctx.listeners['click-right'] || noop}>
{slots.right
? slots.right()
: props.rightText && (
<span class={bem('text')}>{props.rightText}</span>
)}
{RightPart()}
</div>
</div>
);