FabContainer

ion-fab

<ion-fab>本身不是一个FAB按钮,而是一个帮助fab按钮(<button ion-fab>)的容器,允许它放置在不与内容滚动的固定位置。 它也用于实现“材料设计快速拨号”,即。 FAB按钮在单击时显示相关操作的小列表。

使用

<!-- this fab is placed at top right -->
<ion-content>
 <ion-fab top right>
   <button ion-fab>Button</button>
 </ion-fab>

 <!-- this fab is placed at the center of the content viewport -->
 <ion-fab center middle>
   <button ion-fab>Button</button>
 </ion-fab>
</ion-content>

效果:

Ionic FAB还支持“material design's fab speed dia”。 它是一个正常的晶圆厂按钮,显示单击相关操作的列表。

相同的 ion-fab 容器可以包含几个具有不同边值的 ion-fab-list :顶部,底部,左侧和右侧。 例如,如果要在主按钮顶部有一个按钮列表,则应使用side =“top”等。 默认情况下,如果侧面被忽略,side =“bottom”。

<ion-content>
 <!-- this fab is placed at bottom right -->
 <ion-fab bottom right >
   <button ion-fab>Share</button>
   <ion-fab-list side="top">
     <button ion-fab>Facebook</button>
     <button ion-fab>Twitter</button>
     <button ion-fab>Youtube</button>
   </ion-fab-list>
   <ion-fab-list side="left">
     <button ion-fab>Vimeo</button>
   </ion-fab-list>
 </ion-fab>
</ion-content>

也可以通过编程方式关闭FAB speed dial。

<ion-content>
 <ion-fab bottom right #fab>
   <button ion-fab>Share</button>
   <ion-fab-list side="top">
     <button ion-fab (click)="share('facebook', fab)">Facebook</button>
     <button ion-fab (click)="share('twitter', fab)">Twitter</button>
   </ion-fab-list>
 </ion-fab>
</ion-content>
share(socialNet: string, fab: FabContainer) {
  fab.close();
  console.log("Sharing in", socialNet);
}

属性:

Attribute Description
top Places the container on the top of the content
bottom Places the container on the bottom of the content
left Places the container on the left
right Places the container on the right
middle Places the container on the middle vertically
center Places the container on the center horizontally
edge Used to place the container between the content and the header/footer

实例成员

close()

关闭活动的FAB列表容器

Sass 变量

  • All

Property Default Description
$fab-size 56px Width and height of the FAB button
$fab-mini-size 40px Width and height of the FAB button mini
$fab-content-margin 10px Margin of the FAB Container
$fab-list-margin 10px Margin of the FAB List
$fab-list-button-background-color #f4f4f4 Background color of the button in a list
  • iOS

Property Default Description
$fab-ios-background-color color($colors-ios, primary) Background color of the button
$fab-ios-text-color color-contrast($colors-ios, $fab-ios-background-color) Text color of the button
$fab-ios-background-color-activated color-shade($fab-ios-background-color) Background color of the activated button
$fab-ios-list-button-background-color $fab-list-button-background-color Background color of the button in a list
$fab-ios-list-button-text-color color-contrast($colors-ios, $fab-ios-list-button-background-color) Text color of the button in a list
$fab-ios-list-button-background-color-activated color-shade($fab-ios-list-button-background-color) Background color of the activated button in a list
$fab-ios-list-button-transition-duration 200ms Transition duration of the transform and opacity of the button in a list
$fab-ios-list-button-transition-timing-function ease Speed curve of the transition of the transform and opacity of the button in a list
$fab-ios-list-button-transition-delay 10ms Transition delay of the transform and opacity of the button in a list
  • Material Design

Property Default Description
$fab-md-box-shadow 0 4px 6px 0 rgba(0, 0, 0, .14), 0 4px 5px rgba(0, 0, 0, .1) Box shadow of the FAB button
$fab-md-box-shadow-activated 0 5px 15px 0 rgba(0, 0, 0, .4), 0 4px 7px 0 rgba(0, 0, 0, .1) Box shadow of the activated FAB button
$fab-md-background-color color($colors-md, primary) Background color of the button
$fab-md-text-color color-contrast($colors-md, $fab-md-background-color) Text color of the button
$fab-md-background-color-activated color-shade($fab-md-background-color) Background color of the activated button
$fab-md-list-button-background-color $fab-list-button-background-color Background color of the button in a list
$fab-md-list-button-text-color color-contrast($colors-md, $fab-md-list-button-background-color) Text color of the button in a list
$fab-md-list-button-background-color-activated color-shade($fab-md-list-button-background-color) Background color of the activated button in a list
$fab-md-list-button-transition-duration 200ms Transition duration of the transform and opacity of the button in a list
$fab-md-list-button-transition-timing-function ease Speed curve of the transition of the transform and opacity of the button in a list
$fab-md-list-button-transition-delay 10ms Transition delay of the transform and opacity of the button in a list
  • Windows Platform

Property Default Description
$fab-wp-background-color color($colors-wp, primary) Background color of the button
$fab-wp-text-color color-contrast($colors-wp, $fab-wp-background-color) Text color of the button
$fab-wp-background-color-activated color-shade($fab-wp-background-color) Background color of the activated button
$fab-wp-list-button-background-color $fab-list-button-background-color Background color of the button in a list
$fab-wp-list-button-text-color color-contrast($colors-wp, $fab-wp-list-button-background-color) Text color of the button in a list
$fab-wp-list-button-background-color-activated color-shade($fab-wp-list-button-background-color) Background color of the activated button in a list
$fab-wp-list-button-transition-duration 200ms Transition duration of the transform and opacity of the button in a list
$fab-wp-list-button-transition-timing-function ease Speed curve of the transition of the transform and opacity of the button in a list
$fab-wp-list-button-transition-delay 10ms Transition delay of the transform and opacity of the button in a list

相关

FAB 组件文档

results matching ""

    No results matching ""