mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-05 01:19:45 +08:00
811 B
Executable File
811 B
Executable File
order | title | ||||
---|---|---|---|---|---|
3 |
|
zh-CN
使用 visible
属性控制浮层显示。
en-US
Use visible
prop to control the display of the card.
import { Button, Popover } from 'antd';
import React, { useState } from 'react';
const App: React.FC = () => {
const [visible, setVisible] = useState(false);
const hide = () => {
setVisible(false);
};
const handleVisibleChange = (newVisible: boolean) => {
setVisible(newVisible);
};
return (
<Popover
content={<a onClick={hide}>Close</a>}
title="Title"
trigger="click"
visible={visible}
onVisibleChange={handleVisibleChange}
>
<Button type="primary">Click me</Button>
</Popover>
);
};
export default App;