API 浏览器
弹出窗口代理

当你需要显示 QMenu(在较大屏幕上)或 QDialog(在较小屏幕上)时,应使用 QPopupProxy。它充当代理,选择使用两个组件中的任意一个。QPopupProxy 也处理上下文菜单。

¥QPopupProxy should be used when you need either a QMenu (on bigger screens) or a QDialog (on smaller screens) to be displayed. It acts as a proxy which picks either of the two components to use. QPopupProxy also handles context-menus.

Loading QPopupProxy API...

用法(Usage)

¥Usage

提示

使用浏览器开发工具在移动设备和桌面设备之间切换(每次更改后刷新浏览器),或者在点击/轻触其容器之前,物理调整浏览器窗口的大小,观察 QPopupProxy 组件在 QMenu 和 QDialog 之间切换的情况。默认断点设置为 450px。

¥Use your browsers development tools to toggle the device between mobile or desktop (with browser refresh after each change) or, physically resize your browser’s window to watch the QPopupProxy component switch between either a QMenu or a QDialog before clicking/tapping on its container. The default breakpoint is set at 450px.

标准式(Standard)

¥Standard

Standard



上下文菜单(Context menu)

¥Context menu

Context menu (right click / long tap)



断点(Breakpoint)

¥Breakpoint

在下面的示例中,点击输入框中的图标。

¥On the example below, click on the icon in the input.

Breakpoint @600px



传递 props(Pass-through props)

¥Pass-through props

请记住,QMenuQDialog 的所有 prop 都会通过此组件传递。因此,像 offsettransition-show 这样的 props(仅作为示例)可以与 QPopupProxy 结合使用。

¥Keep in mind that all props from both QMenu and QDialog are passed through via this component. So props like offset or transition-show (as a mere example) can be used in conjunction with QPopupProxy.

Props from QMenu or QDialog



警告

QPopupProxy 将某些组件(QDateQTimeQCarouselQColor)视为特殊组件,并强制对它们使用 cover: truemaxHeight: '99vh'。如果你不想要此行为,只需将 div 放置为 QPopupProxy 的第一级子组件即可。

¥QPopupProxy treats some components (QDate, QTime, QCarousel and QColor) as special ones and forces cover: true and maxHeight: '99vh' on them. If you don’t want this behavior just place a div as the first level child of QPopupProxy.