mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-18 19:21:34 +08:00
refactor(demos): give each component section its own view
This commit is contained in:
9
demos/component-docs/actionSheet/actionSheet.html
Normal file
9
demos/component-docs/actionSheet/actionSheet.html
Normal file
@ -0,0 +1,9 @@
|
||||
<ion-navbar *navbar class="show-navbar">
|
||||
<ion-title>Action Sheet</ion-title>
|
||||
</ion-navbar>
|
||||
|
||||
<ion-content class="has-header components-demo padding">
|
||||
<button block (click)="openMenu()">
|
||||
Show Actionsheet
|
||||
</button>
|
||||
</ion-content>
|
64
demos/component-docs/actionSheet/actionSheet.ts
Normal file
64
demos/component-docs/actionSheet/actionSheet.ts
Normal file
@ -0,0 +1,64 @@
|
||||
import {IonicPlatform, IonicView, ActionSheet} from 'ionic/ionic';
|
||||
|
||||
@IonicView({
|
||||
templateUrl: 'actionSheet/actionSheet.html',
|
||||
})
|
||||
export class ActionSheetPage {
|
||||
|
||||
constructor(actionSheet: ActionSheet, platform: IonicPlatform) {
|
||||
this.actionSheet = actionSheet;
|
||||
this.platform = platform;
|
||||
}
|
||||
|
||||
openMenu() {
|
||||
if (this.platform.is('android')) {
|
||||
var androidSheet = {
|
||||
|
||||
buttons: [
|
||||
{ text: 'Share', icon: 'share' },
|
||||
{ text: 'Play', icon: 'arrow-dropright-circle'},
|
||||
{ text: 'Favorite', icon: 'ion-md-heart-outline'}
|
||||
],
|
||||
destructiveText: 'Delete',
|
||||
titleText: 'Purchased',
|
||||
cancelText: 'Cancel',
|
||||
cancel: function() {
|
||||
console.log('Canceled');
|
||||
},
|
||||
destructiveButtonClicked: () => {
|
||||
console.log('Destructive clicked');
|
||||
},
|
||||
buttonClicked: function(index) {
|
||||
console.log('Button clicked', index);
|
||||
if (index == 1) { return false; }
|
||||
return true;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
this.actionSheet.open(androidSheet || {
|
||||
buttons: [
|
||||
{ text: 'Share This' },
|
||||
{ text: 'Move' }
|
||||
],
|
||||
destructiveText: 'Delete',
|
||||
titleText: 'You Opened Action Sheet',
|
||||
cancelText: 'Cancel',
|
||||
cancel: function() {
|
||||
console.log('Canceled');
|
||||
},
|
||||
destructiveButtonClicked: () => {
|
||||
console.log('Destructive clicked');
|
||||
},
|
||||
buttonClicked: function(index) {
|
||||
console.log('Button clicked', index);
|
||||
if (index == 1) { return false; }
|
||||
return true;
|
||||
}
|
||||
|
||||
}).then(actionSheetRef => {
|
||||
this.actionSheetRef = actionSheetRef;
|
||||
});
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user