Skip to content

Commit

Permalink
less code
Browse files Browse the repository at this point in the history
  • Loading branch information
chenshuai2144 committed Nov 2, 2020
1 parent 04658fa commit d6c11fa
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions components/page-header/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,14 @@ const getBackIcon = (props: PageHeaderProps, direction: string = 'ltr') => {
const renderTitle = (prefixCls: string, props: PageHeaderProps, direction: string = 'ltr') => {
const { title, avatar, subTitle, tags, extra, onBack } = props;
const headingPrefixCls = `${prefixCls}-heading`;
// 如果 什么都没有,直接返回一个 空
if (!title && !subTitle && !tags && !extra) {
const hasHeading = title || subTitle || tags || extra;
// 如果 什么都没有,直接返回一个 null
if (!hasHeading) {
return null;
}
const backIcon = getBackIcon(props, direction);
const backIconDom = renderBack(prefixCls, backIcon, onBack);
const hasTitle = backIconDom || avatar || title || subTitle || tags || extra;
const hasTitle = backIconDom || avatar || hasHeading;
return (
<div className={headingPrefixCls}>
{hasTitle && (
Expand Down

0 comments on commit d6c11fa

Please sign in to comment.