ant-design/components/alert/demo/smooth-closed.md
2019-04-19 13:48:29 +01:00

741 B

order title
7
zh-CN en-US
平滑地卸载 Smoothly Unmount

zh-CN

平滑、自然的卸载提示。

en-US

Smoothly unmount Alert upon close.

import { Alert } from 'antd';

class App extends React.Component {
  state = {
    visible: true,
  }

  handleClose = () => {
    this.setState({ visible: false });
  }

  render() {
    return (
      <div>
        {
          this.state.visible ? (
            <Alert
              message="Alert Message Text"
              type="success"
              closable
              afterClose={this.handleClose}
            />
          ) : null
        }
        <p>placeholder text here</p>
      </div>
    );
  }
}

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