返回介绍

Ionic4 侧边栏组件 ion-split-pane

发布于 2019-11-22 18:04:17 字数 4638 浏览 1101 评论 0 收藏 0

Ionic4项目中我们可以使用Ionic4侧边栏组件ion-split-pane对项目进行布局。

ion-split-pane官方文档地址:https://ionicframework.com/docs/api/split-pane

SplitPane is a component that makes it possible to create multi-view layout. Similar to iPad apps, SplitPane allows UI elements, like Menus, to be displayed as the viewport increases.

If the devices screen size is below a certain size, the SplitPane will collapse and the menu will become hidden again. This is especially useful when creating an app that will be served over a browser or deployed through the app store to phones and tablets.

Setting breakpoints

By default, SplitPane will expand when the screen is larger than 992px. If you want to customize this, use the when input. The when input can accept any valid media query, as it uses matchMedia() underneath.

SplitPane also provides some predefined media queries that can be used.


</ion-split-pane>
SizeValueDescription
xs(min-width: 0px)Show the split-pane when the min-width is 0px (meaning, always)
sm(min-width: 576px)Show the split-pane when the min-width is 576px
md(min-width: 768px)Show the split-pane when the min-width is 768px
lg(min-width: 992px)Show the split-pane when the min-width is 992px (default break point)
xl(min-width: 1200px)Show the split-pane when the min-width is 1200px

You can also pass in boolean values that will trigger SplitPane when the value or expression evaluates to true.

ion-split-pane 用法(Usage)


  
  
    
      
        Menu
      
    
  

  
  
</ion-split-pane>

  
  
    
      
        Menu
      
    
  

  
  
    

Hello

</ion-split-pane>
import React from 'react';

import { IonSplitPane, IonMenu, IonHeader, IonToolbar, IonTitle, IonRouterOutlet } from '@ionic/react';

const Example: React.SFC = () => (

  
    {/*--  our side menu  --*/}
    
      
        
          Menu
        
      
    

    {/*-- the main content --*/}
    
  
);

export default Example;

  
    
    
      
        
          Menu
        
      
    

    
    
  
</template>

ion-split-pane 属性(Properties)

contentId

Description

The content id of the split-pane's main content. This property can be used instead of the [main] attribute to select the main content of the split-pane.

Attributecontent-id
Typestring | undefined

disabled

Description

If true, the split pane will be hidden.

Attributedisabled
Typeboolean
Defaultfalse

when

Description

When 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']

ion-split-pane 事件(Events)

NameDescription
ionSplitPaneVisibleExpression to be called when the split-pane visibility has changed

ion-split-pane中的CSS 自定义属性

NameDescription
--borderBorder between panes

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文