【发布时间】:2020-04-29 15:28:21
【问题描述】:
按照 Ionic 文档,我试图让弹出框粘在按钮上 (like on their own example)。 不幸的是,我不知道如何实现这一目标...... 谢谢
import React, { useState } from 'react';
import { IonPopover, IonButton } from '@ionic/react';
export const PopoverExample: React.FC = () => {
const [showPopover, setShowPopover] = useState(false);
return (
<>
<IonPopover
isOpen={showPopover}
onDidDismiss={e => setShowPopover(false)}
>
<p>This is popover content</p>
</IonPopover>
<IonButton onClick={() => setShowPopover(true)}>Show Popover</IonButton>
</>
);
};
【问题讨论】: