国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發(fā)設計 > 正文

Ionic2 Action Sheet詳解

2019-11-06 09:52:31
字體:
供稿:網(wǎng)友

Action Sheet 來源于ios系統(tǒng),從手機下邊 向上展示出一個可選擇的彈出窗口(類似于alert).也可以作為一個應用的 菜單進行導航。

The Action Sheet always appears above any other components on the page, and must be dismissed in order to interact with the underlying content. When it is triggered, the rest of the page darkens to give more focus to the Action Sheet options.

如同alert彈出 Action sheet啟動后總是在所有組件的最上邊處于活動狀態(tài),同時點擊Action Sheet以外的內(nèi)容 Action Sheet必須能夠消失。彈出后 sheet后面會有一個灰色的透明幕。

特別注意: 創(chuàng)建Action Sheet 必須在 局部變量中,不要在構(gòu)造函數(shù)中創(chuàng)建,賦值給實例變量。因為Action Sheet 創(chuàng)建后,被銷毀后整個 nativeElemet就銷毀了。相當于實例變量就指向的元素為空了。 就會報 Cannot read

使用方法:http://ionicframework.com/docs/v2/api/components/action-sheet/ActionSheetController/

import { ActionSheetController } from 'ionic-angular'export class MyClass{ constructor(public actionSheetCtrl: ActionSheetController) {} presentActionSheet() {   let actionSheet = this.actionSheetCtrl.create({//也可通過 setTitle() or addButton()添加參數(shù)     title: 'Modify your album',     buttons: [       {         text: 'Destructive',           role: 'destructive',//兩個角色  destructive cancel  ,cancel會一直在彈出框的最下邊,無論數(shù)組順序。點擊彈出的空白區(qū)域也會觸發(fā)cancel         handler: () => {  //handler中如果有 return false ,彈出就不會 消失           console.log('Destructive clicked');         }       },       {         text: 'Archive',         handler: () => {           let navTransition = actionSheet.dismiss(); //點擊button 多個操作例如跳轉(zhuǎn),手動銷毀彈出,然后等待銷毀后,再進行其它操作。      	   // start some async method      	   someAsyncOperation().then(() => {                // once the async operation has completed                // then run the next nav transition after the                // first transition has finished animating out                 navTransition.then(() => {                     this.nav.pop();                 });            });            return false;         }       },       {         text: 'Cancel',         role: 'cancel',         handler: () => {           console.log('Cancel clicked');         }       }     ]   });   actionSheet.present(); }}


發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 通河县| 古蔺县| 大港区| 锦州市| 白朗县| 武平县| 抚州市| 湘潭市| 石首市| 潮州市| 株洲市| 岳阳县| 焦作市| 双江| 通山县| 梅州市| 崇阳县| 北宁市| 东方市| 石家庄市| 平安县| 南城县| 万年县| 南充市| 麻阳| 临安市| 工布江达县| 都兰县| 稷山县| 正镶白旗| 太康县| 德昌县| 常德市| 浦县| 桐乡市| 弥渡县| 南京市| 平利县| 高安市| 冕宁县| 泰宁县|