You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

51 lines
845 B

---
order: 3
title:
zh-CN: 从浮层内关闭
en-US: Controlling the close of the dialog
---
9 years ago
## zh-CN
9 years ago
使用 `visible` 属性控制浮层显示。
## en-US
Use `visible` prop to control the display of the card.
```jsx
9 years ago
import { Popover, Button } from 'antd';
class App extends React.Component {
state = {
visible: false,
};
hide = () => {
9 years ago
this.setState({
visible: false,
9 years ago
});
};
handleVisibleChange = visible => {
9 years ago
this.setState({ visible });
};
9 years ago
render() {
return (
<Popover
content={<a onClick={this.hide}>Close</a>}
title="Title"
trigger="click"
visible={this.state.visible}
onVisibleChange={this.handleVisibleChange}
>
<Button type="primary">Click me</Button>
</Popover>
);
}
}
9 years ago
ReactDOM.render(<App />, mountNode);
```