mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-20 20:33:32 +08:00
docs(demos): update action sheet demo to have icons for MD
This commit is contained in:
@ -1,4 +1,4 @@
|
|||||||
import {App, Page, ActionSheet, NavController} from 'ionic/ionic';
|
import {App, Page, ActionSheet, NavController, Platform} from 'ionic/ionic';
|
||||||
|
|
||||||
|
|
||||||
@App({
|
@App({
|
||||||
@ -15,24 +15,79 @@ class ApiDemoApp {
|
|||||||
templateUrl: 'main.html'
|
templateUrl: 'main.html'
|
||||||
})
|
})
|
||||||
export class InitialPage {
|
export class InitialPage {
|
||||||
constructor(nav: NavController) {
|
constructor(nav: NavController, platform: Platform) {
|
||||||
this.nav = nav;
|
this.nav = nav;
|
||||||
|
this.platform = platform;
|
||||||
}
|
}
|
||||||
|
|
||||||
present() {
|
present() {
|
||||||
let actionSheet = ActionSheet.create({
|
if (this.platform.is('android')) {
|
||||||
|
var androidSheet = {
|
||||||
|
title: 'Albums',
|
||||||
|
buttons: [
|
||||||
|
{ text: 'Share',
|
||||||
|
icon: 'share',
|
||||||
|
handler: () => {
|
||||||
|
console.log('Share clicked');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{ text: 'Play',
|
||||||
|
icon: 'arrow-dropright-circle',
|
||||||
|
handler: () => {
|
||||||
|
console.log('Play clicked');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{ text: 'Favorite',
|
||||||
|
icon: 'md-heart-outline',
|
||||||
|
handler: () => {
|
||||||
|
console.log('Favorite clicked');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: 'Delete',
|
||||||
|
style: 'destructive',
|
||||||
|
icon: 'md-trash',
|
||||||
|
handler: () => {
|
||||||
|
console.log('Destructive clicked');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: 'Cancel',
|
||||||
|
style: 'cancel',
|
||||||
|
icon: 'md-close',
|
||||||
|
handler: () => {
|
||||||
|
console.log('Cancel clicked');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
let actionSheet = ActionSheet.create( androidSheet || {
|
||||||
buttons: [
|
buttons: [
|
||||||
{
|
{
|
||||||
text: 'Destructive',
|
text: 'Share',
|
||||||
style: 'destructive',
|
|
||||||
handler: () => {
|
handler: () => {
|
||||||
console.log('Destructive clicked');
|
console.log('Share clicked');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
text: 'Archive',
|
text: 'Play',
|
||||||
handler: () => {
|
handler: () => {
|
||||||
console.log('Archive clicked');
|
console.log('Play clicked');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: 'Favorite',
|
||||||
|
handler: () => {
|
||||||
|
console.log('Favorite clicked');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: 'Delete',
|
||||||
|
style: 'destructive',
|
||||||
|
handler: () => {
|
||||||
|
console.log('Destructive clicked');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user