Skip to main content

ion-split-pane

shadow

创建多视图布局时,分割窗格非常有用。它允许 UI 元素(如菜单)随着视口宽度的增加而显示。

¥A split pane is useful when creating multi-view layouts. It allows UI elements, like menus, to be displayed as the viewport width increases.

如果设备的屏幕宽度低于特定尺寸,分割窗格将折叠并且菜单将被隐藏。这非常适合创建在浏览器中提供服务并通过应用商店部署到手机和平板电脑的应用。

¥If the device's screen width is below a certain size, the split pane will collapse and the menu will be hidden. This is ideal for creating an app that will be served in a browser and deployed through the app store to phones and tablets.

基本用法

¥Basic Usage

注意

此演示将 when 属性设置为 'xs',以便始终显示分割窗格。如果你希望拆分窗格在较小的视口上折叠,你的 Ionic 应用不需要此操作。请参阅 设置断点 了解更多信息。

¥This demo sets the when property to 'xs' so the split pane always shows up. Your Ionic application does not need this if you want the split pane to collapse on smaller viewports. See Setting Breakpoints for more information.

设置断点

¥Setting Breakpoints

默认情况下,当屏幕大于 992px 时,分割窗格将会展开。要对此进行自定义,请在 when 属性中传递断点。when 属性可以接受布尔值、任何有效的媒体查询或 Ionic 的预定义大小之一。

¥By default, the split pane will expand when the screen is larger than 992px. To customize this, pass a breakpoint in the when property. The when property can accept a boolean value, any valid media query, or one of Ionic's predefined sizes.

<!-- can be "xs", "sm", "md", "lg", or "xl" -->
<ion-split-pane when="md"></ion-split-pane>

<!-- can be any valid media query https://web.nodejs.cn/en-US/docs/Web/CSS/Media_Queries/Using_media_queries -->
<ion-split-pane when="(min-width: 40px)"></ion-split-pane>
尺寸描述
xs(min-width: 0px)当最小宽度为 0px 时显示分割窗格(意思是,始终)
sm(min-width: 576px)当最小宽度为 576px 时显示分割窗格
md(min-width: 768px)当最小宽度为 768px 时显示分割窗格
lg(min-width: 992px)当最小宽度为 992px 时显示分割窗格(默认断点)
xl(min-width: 1200px)当最小宽度为 1200px 时显示分割窗格

主题化

¥Theming

CSS 自定义属性

¥CSS Custom Properties

属性

¥Properties

contentId

DescriptionThe id of the main content. When using a router this is typically ion-router-outlet. When not using a router, this is typically your main view's ion-content. This is not the id of the ion-content inside of your ion-menu.
Attributecontent-id
Typestring | undefined
Defaultundefined

disabled

DescriptionIf true, the split pane will be hidden.
Attributedisabled
Typeboolean
Defaultfalse

when

DescriptionWhen the split-pane should be shown. Can be a CSS media query expression, or a shortcut expression. Can also be a boolean expression.
Attributewhen
Typeboolean | string
DefaultQUERY['lg']

事件

¥Events

NameDescriptionBubbles
ionSplitPaneVisibleExpression to be called when the split-pane visibility has changedtrue

方法

¥Methods

No public methods available for this component.

CSS 阴影部分

¥CSS Shadow Parts

No CSS shadow parts available for this component.

CSS 自定义属性

¥CSS Custom Properties

NameDescription
--borderBorder between panes
--side-max-widthMaximum width of the side pane. Does not apply when split pane is collapsed.
--side-min-widthMinimum width of the side pane. Does not apply when split pane is collapsed.
--side-widthWidth of the side pane. Does not apply when split pane is collapsed.

插槽

¥Slots

No slots available for this component.