返回介绍

Ionic4 导航条组件 ion-back-button

发布于 2019-11-22 18:04:19 字数 6469 浏览 1028 评论 0 收藏 0

Ionic4项目中我们可以使用Ionic4导航条组件ion-back-button对项目进行布局。

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

The back button navigates back in the app's history upon click. It is smart enough to know what to render based on the mode and when to show based on the navigation stack.

To change what is displayed in the back button, use the text and icon properties.

ion-back-button 用法(Usage)



  
    
      
    
  




  
    
      
    
  




  
    
      
      
    
  




  
    
      
    
  




  
    
      
      
    
  
</ion-header>


  
    
      
    
  




  
    
      
    
  




  
    
      
    
  




  
    
      
    
  




  
    
      
      
    
  
</ion-header>
import React from 'react';

import { IonBackButton, IonHeader, IonToolbar, IonButtons, IonMenuButton } from '@ionic/react';

const Example: React.SFC = () => (
  
    {/*-- Default back button --*/}
    
      
        
           {}} />
        
      
    

    {/*-- Back button with a default href --*/}
    
      
        
           {}} defaultHref="home" />
        
      
    

    {/*-- Back button with custom text and icon --*/}
    
      
        
           {}}
            text="buttonText"
            icon="buttonIcon"
          />
        
      
    

    {/*-- Back button with no text and custom icon --*/}
    
      
        
           {}} text="" icon="add" />
        
      
    

    {/*-- Danger back button next to a menu button --*/}
    
      
        
          
           {}} color="danger" />
        
      
    
  
);

export default Example;

  
  
    
      
        
      
    
  

  
  
    
      
        
      
    
  

  
  
    
      
        
        
      
    
  

  
  
    
      
        
      
    
  

  
  
    
      
        
        
      
    
  
</template>

ion-back-button 属性(Properties)

color

Description

The color to use from your application's color palette. Default options are: "primary", "secondary", "tertiary", "success", "warning", "danger", "light", "medium", and "dark". For more information on colors, see theming.

Attributecolor
Typestring | undefined

defaultHref

Description

The url to navigate back to by default when there is no history.

Attributedefault-href
Typestring | undefined

icon

Description

The icon name to use for the back button.

Attributeicon
Typenull | string | undefined

mode

Description

The mode determines which platform styles to use.

Attributemode
Type"ios" | "md"

text

Description

The text to display in the back button.

Attributetext
Typenull | string | undefined

ion-back-button中的CSS 自定义属性

NameDescription
--backgroundBackground of the button
--border-radiusBorder radius of the button
--colorText color of the button
--icon-font-sizeFont size of the button icon
--icon-font-weightFont weight of the button icon
--icon-margin-bottomMargin bottom of the button icon
--icon-margin-endMargin end of the button icon
--icon-margin-startMargin start of the button icon
--icon-margin-topMargin top of the button icon
--icon-padding-bottomPadding bottom of the button icon
--icon-padding-endPadding end of the button icon
--icon-padding-startPadding start of the button icon
--icon-padding-topPadding top of the button icon
--margin-bottomMargin bottom of the button
--margin-endMargin end of the button
--margin-startMargin start of the button
--margin-topMargin top of the button
--min-heightMinimum height of the button
--min-widthMinimum width of the button
--opacityOpacity of the button
--padding-bottomPadding bottom of the button
--padding-endPadding end of the button
--padding-startPadding start of the button
--padding-topPadding top of the button
--ripple-colorColor of the button ripple effect
--transitionTransition of the button

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

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

发布评论

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