mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-12-01 03:29:39 +08:00
less code
This commit is contained in:
parent
04658fa0a4
commit
d6c11fa901
@ -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 && (
|
||||
|
Loading…
Reference in New Issue
Block a user