Action Sheet

Contents

The ActionSheet plugin shows a native list of options the user can choose from.

https://github.com/EddyVerbruggen/cordova-plugin-actionsheet

Ionic 底部弹出框Action Sheet插件的安装(Installation)

ionic cordova plugin add cordova-plugin-actionsheet npm install @ionic-native/action-sheet

Ionic 底部弹出框Action Sheet插件支持的平台(Supported Platforms)

  • Android
  • Browser
  • iOS
  • Windows
  • Windows Phone 8

Ionic 底部弹出框Action Sheet插件的用法(Usage)

import { ActionSheet, ActionSheetOptions } from '@ionic-native/action-sheet';

constructor(private actionSheet: ActionSheet) { }

...


let buttonLabels = ['Share via Facebook', 'Share via Twitter'];

const options: ActionSheetOptions = {
  title: 'What do you want with this image?',
  subtitle: 'Choose an action',
  buttonLabels: buttonLabels,
  addCancelButtonWithLabel: 'Cancel',
  addDestructiveButtonWithLabel: 'Delete',
  androidTheme: this.actionSheet.ANDROID_THEMES.THEME_HOLO_DARK,
  destructiveButtonLast: true
};

this.actionSheet.show(options).then((buttonIndex: number) => {
  console.log('Button pressed: ' + buttonIndex);
});