mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-20 12:29:55 +08:00
demos(actionSheet): update actionsheet
This commit is contained in:
@ -1,2 +1 @@
|
|||||||
<ion-nav id="nav" [root]="rootPage" #content></ion-nav>
|
<ion-nav [root]="rootPage"></ion-nav>
|
||||||
<ion-overlay></ion-overlay>
|
|
||||||
|
@ -1,51 +1,50 @@
|
|||||||
import {App, Page, IonicApp, Config, Platform} from 'ionic/ionic';
|
import {App, Page, ActionSheet, NavController} from 'ionic/ionic';
|
||||||
import {ActionSheet} from 'ionic/ionic';
|
|
||||||
|
|
||||||
@App({
|
@App({
|
||||||
templateUrl: 'app.html'
|
templateUrl: 'app.html'
|
||||||
})
|
})
|
||||||
class ApiDemoApp {
|
class ApiDemoApp {
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
this.rootPage = InitialPage;
|
this.rootPage = InitialPage;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Page({
|
@Page({
|
||||||
templateUrl: 'main.html'
|
templateUrl: 'main.html'
|
||||||
})
|
})
|
||||||
export class InitialPage {
|
export class InitialPage {
|
||||||
constructor(actionSheet: ActionSheet, platform: Platform) {
|
constructor(nav: NavController) {
|
||||||
this.actionSheet = actionSheet;
|
this.nav = nav;
|
||||||
this.platform = platform;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
open() {
|
present() {
|
||||||
|
let actionSheet = ActionSheet.create({
|
||||||
this.actionSheet.open({
|
|
||||||
buttons: [
|
buttons: [
|
||||||
{ text: 'Share'},
|
{
|
||||||
{ text: 'Play'},
|
text: 'Destructive',
|
||||||
{ text: 'Favorite'}
|
style: 'destructive',
|
||||||
],
|
handler: () => {
|
||||||
destructiveText: 'Delete',
|
console.log('Destructive clicked');
|
||||||
titleText: 'Albums',
|
}
|
||||||
cancelText: 'Cancel',
|
},
|
||||||
cancel: () => {
|
{
|
||||||
console.log('Canceled');
|
text: 'Archive',
|
||||||
},
|
handler: () => {
|
||||||
destructiveButtonClicked: () => {
|
console.log('Archive clicked');
|
||||||
console.log('Destructive clicked');
|
}
|
||||||
},
|
},
|
||||||
buttonClicked: (index) => {
|
{
|
||||||
console.log('Button clicked', index);
|
text: 'Cancel',
|
||||||
if (index == 1) { return false; }
|
style: 'cancel',
|
||||||
return true;
|
handler: () => {
|
||||||
}
|
console.log('Cancel clicked');
|
||||||
|
}
|
||||||
}).then(actionSheetRef => {
|
}
|
||||||
this.actionSheetRef = actionSheetRef;
|
]
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.nav.present(actionSheet);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,6 +4,6 @@
|
|||||||
|
|
||||||
<ion-content padding>
|
<ion-content padding>
|
||||||
<ion-row>
|
<ion-row>
|
||||||
<button full block (click)="open()">Open Action Sheet</button>
|
<button full block (click)="present()">Open Action Sheet</button>
|
||||||
</ion-row>
|
</ion-row>
|
||||||
<ion-content>
|
<ion-content>
|
||||||
|
Reference in New Issue
Block a user