mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-20 12:29:55 +08:00
102 lines
2.1 KiB
TypeScript
102 lines
2.1 KiB
TypeScript
import {App, Page, ActionSheet, NavController} from 'ionic-angular';
|
|
|
|
|
|
@Page({
|
|
templateUrl: 'main.html'
|
|
})
|
|
class E2EPage {
|
|
result: string = '';
|
|
|
|
constructor(private nav: NavController) {}
|
|
|
|
presentActionSheet1() {
|
|
this.result = '';
|
|
|
|
let actionSheet = ActionSheet.create({
|
|
title: 'Modify your album',
|
|
buttons: [
|
|
{
|
|
text: 'Destructive',
|
|
role: 'destructive',
|
|
handler: () => {
|
|
console.log('Destructive clicked');
|
|
this.result = 'Destructive';
|
|
}
|
|
},
|
|
{
|
|
text: 'Archive',
|
|
handler: () => {
|
|
console.log('Archive clicked');
|
|
this.result = 'Archived';
|
|
}
|
|
},
|
|
{
|
|
text: 'No close',
|
|
handler: () => {
|
|
console.log('do not close clicked');
|
|
|
|
// returning false does not allow the actionsheet to be closed
|
|
return false;
|
|
}
|
|
},
|
|
{
|
|
text: 'Cancel',
|
|
role: 'cancel', // will always sort to be on the bottom
|
|
handler: () => {
|
|
console.log('Cancel clicked');
|
|
this.result = 'Canceled';
|
|
}
|
|
}
|
|
]
|
|
});
|
|
|
|
this.nav.present(actionSheet);
|
|
}
|
|
|
|
presentActionSheet2(ev) {
|
|
this.result = '';
|
|
|
|
let actionSheet = ActionSheet.create({
|
|
enableBackdropDismiss: false,
|
|
buttons: [
|
|
{
|
|
text: 'Archive',
|
|
handler: () => {
|
|
console.log('Archive clicked');
|
|
this.result = 'Archived';
|
|
}
|
|
},
|
|
{
|
|
text: 'Cancel',
|
|
role: 'cancel',
|
|
handler: () => {
|
|
console.log('cancel this clicked');
|
|
this.result = 'Canceled';
|
|
}
|
|
},
|
|
{
|
|
text: 'Destructive',
|
|
role: 'destructive',
|
|
handler: () => {
|
|
console.log('Destructive clicked');
|
|
this.result = 'Destructive';
|
|
}
|
|
}
|
|
]
|
|
});
|
|
|
|
this.nav.present(actionSheet);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
@App({
|
|
template: '<ion-nav [root]="root"></ion-nav>'
|
|
})
|
|
class E2EApp {
|
|
constructor() {
|
|
this.root = E2EPage;
|
|
}
|
|
}
|