mirror of
https://github.com/ant-design/ant-design.git
synced 2025-01-18 22:36:31 +08:00
ref #498
This commit is contained in:
parent
bd826a2582
commit
09c208831f
38
components/popover/demo/control.md
Normal file
38
components/popover/demo/control.md
Normal file
@ -0,0 +1,38 @@
|
||||
# 从浮层内关闭
|
||||
|
||||
- order: 3
|
||||
|
||||
使用 `visible` 属性控制浮层显示。
|
||||
|
||||
---
|
||||
|
||||
````jsx
|
||||
import { Popover, Button } from 'antd';
|
||||
|
||||
const App = React.createClass({
|
||||
getInitialState() {
|
||||
return {
|
||||
visible: false
|
||||
};
|
||||
},
|
||||
hide() {
|
||||
this.setState({
|
||||
visible: false
|
||||
});
|
||||
},
|
||||
handleVisibleChange(visible) {
|
||||
this.setState({ visible });
|
||||
},
|
||||
render() {
|
||||
const content = <div>
|
||||
<a onClick={this.hide}>关闭卡片</a>
|
||||
</div>;
|
||||
return <Popover overlay={content} title="标题" trigger="click"
|
||||
visible={this.state.visible} onVisibleChange={this.handleVisibleChange}>
|
||||
<Button type="primary">点击弹出卡片</Button>
|
||||
</Popover>;
|
||||
}
|
||||
});
|
||||
|
||||
ReactDOM.render(<App />, document.getElementById('components-popover-demo-control'));
|
||||
````
|
Loading…
Reference in New Issue
Block a user