mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-20 20:33:32 +08:00
docs(demos): fix actionSheet demo
This commit is contained in:
@ -23,43 +23,19 @@ export class BasicPage {
|
|||||||
|
|
||||||
if (this.platform.is('android')) {
|
if (this.platform.is('android')) {
|
||||||
var androidSheet = {
|
var androidSheet = {
|
||||||
|
|
||||||
buttons: [
|
|
||||||
{ text: 'Share', icon: 'share' },
|
|
||||||
{ text: 'Play', icon: 'arrow-dropright-circle'},
|
|
||||||
{ text: 'Favorite', icon: 'ion-md-heart-outline'}
|
|
||||||
],
|
|
||||||
destructiveText: 'Delete',
|
|
||||||
titleText: 'Albums',
|
|
||||||
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 = ActionSheet.create(androidSheet || {
|
|
||||||
title: 'Albums',
|
title: 'Albums',
|
||||||
buttons: [
|
buttons: [
|
||||||
{
|
{ text: 'Share',
|
||||||
text: 'Share',
|
handler: buttonHandler,
|
||||||
handler: buttonHandler
|
icon: 'share'
|
||||||
},
|
},
|
||||||
{
|
{ text: 'Play',
|
||||||
text: 'Play',
|
handler: buttonHandler,
|
||||||
handler: buttonHandler
|
icon: 'arrow-dropright-circle'
|
||||||
},
|
},
|
||||||
{
|
{ text: 'Favorite',
|
||||||
text: 'Favorite',
|
handler: buttonHandler,
|
||||||
handler: buttonHandler
|
icon: 'ion-md-heart-outline'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
text: 'Delete',
|
text: 'Delete',
|
||||||
@ -72,18 +48,55 @@ export class BasicPage {
|
|||||||
text: 'Cancel',
|
text: 'Cancel',
|
||||||
style: 'cancel',
|
style: 'cancel',
|
||||||
handler: () => {
|
handler: () => {
|
||||||
console.log('Canceled');
|
console.log('Cancel clicked');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
let actionSheet = ActionSheet.create( androidSheet || {
|
||||||
|
buttons: [
|
||||||
|
{
|
||||||
|
text: 'Share',
|
||||||
|
handler: () => {
|
||||||
|
console.log('Share clicked');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: 'Play',
|
||||||
|
handler: () => {
|
||||||
|
console.log('Play clicked');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: 'Favorite',
|
||||||
|
handler: () => {
|
||||||
|
console.log('Favorite clicked');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: 'Delete',
|
||||||
|
style: 'destructive',
|
||||||
|
handler: () => {
|
||||||
|
console.log('Destructive clicked');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: 'Cancel',
|
||||||
|
style: 'cancel',
|
||||||
|
handler: () => {
|
||||||
|
console.log('Cancel clicked');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
});
|
});
|
||||||
|
|
||||||
this.nav.present(this.actionSheet);
|
this.nav.present(actionSheet);
|
||||||
}
|
}
|
||||||
|
|
||||||
onPageWillLeave() {
|
onPageWillLeave() {
|
||||||
this.actionSheet && this.actionSheet.dismiss();
|
actionSheet && actionSheet.dismiss();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -36,8 +36,6 @@ class DemoApp {
|
|||||||
|
|
||||||
window.addEventListener('message', (e) => {
|
window.addEventListener('message', (e) => {
|
||||||
//TODO(@drewrygh)
|
//TODO(@drewrygh)
|
||||||
e = {};
|
|
||||||
e.data = '{}';
|
|
||||||
zone.run(() => {
|
zone.run(() => {
|
||||||
if (e.data) {
|
if (e.data) {
|
||||||
var data;
|
var data;
|
||||||
|
Reference in New Issue
Block a user