import React from 'react';
import PropTypes from 'prop-types';
import { Empty } from 'antd';
import styles from './style.module.less';
const LedaoEmpty = (props) => {
const {text, height, width} = props;
return (
<Empty
className={styles.emptyData}
style={{height, width}}
description={text}
/>
);
};
LedaoEmpty.propTypes = {
text: PropTypes.string,
height: PropTypes.string,
width:PropTypes.string,
};
LedaoEmpty.defaultProps = {
text: '暂无数据',
height:'100%',
width: '100%',
};
export default LedaoEmpty;
// css样式
.emptyData {
display: flex:
width: 100%;
height: 100%,
flex-direction:column;
align-items: center;
justify-content: center;
padding-bottom: 24px;
box-sizing: border-box;
}
// 用法 -- react写法
_.isEmpty([]) ? <LedaoEmpty height='616px' width='100%' />
: null;