加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

角度 – 按下按钮时Ionic2关闭fab菜单

发布时间:2020-12-17 09:52:27 所属栏目:安全 来源:网络整理
导读:如果按下菜单中的按钮,如何关闭打开的FAB菜单? 这是我的按钮. ion-fab bottom center button ion-fabbHello/b/buttonion-fab-list side="top"button ion-fab (click)="refresh()"ion-icon name="refresh"/ion-icon/button 我需要添加什么来刷新以使整个FAB
如果按下菜单中的按钮,如何关闭打开的FAB菜单?

这是我的按钮.

<ion-fab bottom center >
<button ion-fab><b>Hello</b></button>
<ion-fab-list side="top">
<button ion-fab (click)="refresh()"><ion-icon name="refresh"></ion-icon></button>

我需要添加什么来刷新以使整个FAB关闭?
我可以以某种方式从代码中引用html对象吗?类似于iOS处理它的出口的方式?

只需将#fab添加到ion-fab标签:
<ion-fab bottom center #fab>
    <button ion-fab (click)="refresh(fab)"> 
        <ion-icon name="refresh"></ion-icon>       
    </button>
</ion-fab>

并使用FabContainer方法close()关闭FAB按钮调用的任何函数开头的FAB菜单(如果打开),例如:

import { FabContainer } from 'ionic-angular';

// remember to pass the fab from client side
refresh(fab?: FabContainer):void {
    if (fab !== undefined) {
      fab.close();
    }
    (other function stuff...)
}

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读