ant-design/components/card/demo/loading.md
2016-02-22 16:28:00 +08:00

629 B

预加载的卡片

  • order: 4

数据读入前会有文本块样式。


import { Card } from 'antd';

const App = React.createClass({
  getInitialState() {
    return {
      loading: true,
      content: '',
    };
  },
  componentDidMount() {
    // mock loading
    setTimeout(() => {
      this.setState({
        loading: false,
        content: '卡片的内容',
      });
    }, 2000);
  },
  render() {
    return (
      <Card loading={this.state.loading} title="卡片标题" style={{ width: 300 }}>
        {this.state.content}
      </Card>
    );
  },
});

ReactDOM.render(<App />, mountNode);