ant-design/components/popover/demo/control.md
2017-01-19 15:22:53 +08:00

869 B
Executable File

order title
3
zh-CN en-US
从浮层内关闭 Controlling the close of the dialog

zh-CN

使用 visible 属性控制浮层显示。

en-US

Use visible prop to control the display of the card.

import { Popover, Button } from 'antd';

const App = React.createClass({
  getInitialState() {
    return {
      visible: false,
    };
  },
  hide() {
    this.setState({
      visible: false,
    });
  },
  handleVisibleChange(visible) {
    this.setState({ visible });
  },
  render() {
    return (
      <Popover
        content={<a onClick={this.hide}>Close</a>}
        title="Title"
        trigger="click"
        visible={this.state.visible}
        onVisibleChange={this.handleVisibleChange}
      >
        <Button type="primary">Cilck me</Button>
      </Popover>
    );
  },
});

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