Empty空状态
空状态时的展示占位图。
何时使用
当目前没有数据时,用于显式的用户提示。
初始化场景时的引导创建流程。
代码演示

简单的展示。
import { Empty } from 'antd';ReactDOM.render(<Empty />, mountNode);

可以通过设置 image 为 Empty.PRESENTED_IMAGE_SIMPLE 选择另一种风格的图片。
import { Empty } from 'antd';ReactDOM.render(<Empty image={Empty.PRESENTED_IMAGE_SIMPLE} />, mountNode);

自定义图片链接、图片大小、描述、附属内容。
import { Empty, Button } from 'antd';ReactDOM.render(<Emptyimage="https://gw.alipayobjects.com/zos/antfincdn/ZHrcdLPrvN/empty.svg"imageStyle={{height: 60,}}description={<span>Customize <a href="#API">Description</a></span>}><Button type="primary">Create Now</Button></Empty>,mountNode,);

自定义全局组件的 Empty 样式。
import {ConfigProvider,Switch,Divider,TreeSelect,Select,Cascader,Transfer,Table,List,} from 'antd';import { SmileOutlined } from '@ant-design/icons';const customizeRenderEmpty = () => (<div style={{ textAlign: 'center' }}><SmileOutlined style={{ fontSize: 20 }} /><p>Data Not Found</p></div>);const style = { width: 200 };class Demo extends React.Component {state = {customize: false,};render() {const { customize } = this.state;return (<div><SwitchunCheckedChildren="default"checkedChildren="customize"checked={customize}onChange={val => {this.setState({ customize: val });}}/><Divider /><ConfigProvider renderEmpty={customize && customizeRenderEmpty}><div className="config-provider"><h4>Select</h4><Select style={style} /><h4>TreeSelect</h4><TreeSelect style={style} treeData={[]} /><h4>Cascader</h4><Cascader style={style} options={[]} showSearch /><h4>Transfer</h4><Transfer /><h4>Table</h4><Tablestyle={{ marginTop: 8 }}columns={[{title: 'Name',dataIndex: 'name',key: 'name',},{title: 'Age',dataIndex: 'age',key: 'age',},]}/><h4>List</h4><List /></div></ConfigProvider></div>);}}ReactDOM.render(<Demo />, mountNode);

无描述展示。
import { Empty } from 'antd';ReactDOM.render(<Empty description={false} />, mountNode);
API
<Empty><Button>创建</Button></Empty>
| 参数 | 说明 | 类型 | 默认值 | 版本 |
|---|---|---|---|---|
| description | 自定义描述内容 | ReactNode | - | |
| image | 设置显示图片,为 string 时表示自定义图片地址。 | ReactNode | Empty.PRESENTED_IMAGE_DEFAULT | |
| imageStyle | 图片样式 | CSSProperties | - |
内置图片
Empty.PRESENTED_IMAGE_SIMPLE
Empty.PRESENTED_IMAGE_DEFAULT