Ionic2 Action Sheet详解
来源:互联网 发布:jsp如何连接sqlserver 编辑:程序博客网 时间:2024/06/04 19:21
Action Sheet 来源于ios系统,从手机下边 向上展示出一个可选择的弹出窗口(类似于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启动后总是在所有组件的最上边处于活动状态,同时点击Action Sheet以外的内容 Action Sheet必须能够消失。弹出后 sheet后面会有一个灰色的透明幕。
特别注意: 创建Action Sheet 必须在 局部变量中,不要在构造函数中创建,赋值给实例变量。因为Action Sheet 创建后,被销毁后整个 nativeElemet就销毁了。相当于实例变量就指向的元素为空了。 就会报 Cannot read property 'nativeElement' of null 错误。
使用方法: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()添加参数
title: 'Modify your album', buttons: [ { text: 'Destructive', role: 'destructive',//两个角色 destructive cancel ,cancel会一直在弹出框的最下边,无论数组顺序。点击弹出的空白区域也会触发cancel handler: () => { //handler中如果有 return false ,弹出就不会 消失 console.log('Destructive clicked'); } }, { text: 'Archive', handler: () => { let navTransition = actionSheet.dismiss(); //点击button 多个操作例如跳转,手动销毁弹出,然后等待销毁后,再进行其它操作。 // 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(); }}
0 0
- Ionic2 Action Sheet详解
- action sheet
- action sheet
- Delegate,Action Sheet, Alert
- Message Box (Action Sheet) General
- action sheet 也来 block ~
- ionic2
- Android Bottom Sheet详解
- Android Bottom Sheet详解
- Android Bottom Sheet详解
- Android Bottom Sheet详解
- Android Bottom Sheet详解
- Android Bottom Sheet详解
- ionic2/ionic3自定义Action Sheets和Alerts组件的样式
- Presenting action sheet clipped by its superview
- ionic添加cordova插件-Action Sheet
- action-sheet和showActionSheet的区别
- iphone dev--如何让uiAlertView、action sheet用代码消失
- C++中explicit的用法
- Oracle 修改表字段的数据 number 改为 number(5,2) 保留5位小数
- uva 674 && hdu 2069 coin change(动态规划、母函数)
- 使用ShaderToy来处理VR畸变
- 步进电机综合控制
- Ionic2 Action Sheet详解
- Android Studio Android项目内嵌入React Native混合开发
- [percona-toolkit] pt-mysql-summary分析mysq数据库
- codeforces 777D. Cloud of Hashtags (逆序思维)
- 在本地用命令行创建一个git仓库,并推送到远程
- js里声明函数有几种方式? var abc = function(x){} 和 function abc(x){} 这两种声明方法有什么不同?
- safari浏览器数字显示长度不一致的问题
- Android项目针对libs(armeabi,armeabi-v7a,x86)进行平台兼容
- [BZOJ2082][Poi2010][质因数分解][乱搞]Divine divisor