--- order: 5 title: zh-CN: 悬停点击弹出窗口 en-US: Hover with click popover --- ## zh-CN 以下示例显示如何创建可悬停和单击的弹出窗口。 ## en-US The following example shows how to create a popover which can be hovered and clicked. ```tsx import React, { useState } from 'react'; import { Popover, Button } from 'antd'; const App: React.FC = () => { const [clicked, setClicked] = useState(false); const [hovered, setHovered] = useState(false); const hide = () => { setClicked(false); setHovered(false); }; const handleHoverChange = (visible: boolean) => { setHovered(visible); setClicked(false); }; const handleClickChange = (visible: boolean) => { setHovered(false); setClicked(visible); }; const hoverContent =
This is hover content.
; const clickContent =
This is click content.
; return ( {clickContent} Close } title="Click title" trigger="click" visible={clicked} onVisibleChange={handleClickChange} > ); }; export default App; ```