mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-19 03:32:21 +08:00
52 lines
1.0 KiB
TypeScript
52 lines
1.0 KiB
TypeScript
import {App, Page, IonicApp, Config, Platform} from 'ionic/ionic';
|
|
import {ActionSheet} from 'ionic/ionic';
|
|
|
|
@App({
|
|
templateUrl: 'app.html'
|
|
})
|
|
class ApiDemoApp {
|
|
|
|
constructor() {
|
|
this.rootPage = InitialPage;
|
|
}
|
|
}
|
|
|
|
@Page({
|
|
templateUrl: 'main.html'
|
|
})
|
|
export class InitialPage {
|
|
constructor(actionSheet: ActionSheet, platform: Platform) {
|
|
this.actionSheet = actionSheet;
|
|
this.platform = platform;
|
|
}
|
|
|
|
open() {
|
|
|
|
this.actionSheet.open({
|
|
buttons: [
|
|
{ text: 'Share'},
|
|
{ text: 'Play'},
|
|
{ text: 'Favorite'}
|
|
],
|
|
destructiveText: 'Delete',
|
|
titleText: 'Albums',
|
|
cancelText: 'Cancel',
|
|
cancel: () => {
|
|
console.log('Canceled');
|
|
},
|
|
destructiveButtonClicked: () => {
|
|
console.log('Destructive clicked');
|
|
},
|
|
buttonClicked: (index) => {
|
|
console.log('Button clicked', index);
|
|
if (index == 1) { return false; }
|
|
return true;
|
|
}
|
|
|
|
}).then(actionSheetRef => {
|
|
this.actionSheetRef = actionSheetRef;
|
|
});
|
|
}
|
|
}
|
|
|