mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
docs(action-sheet): rename docs directory to usage
This commit is contained in:
56
core/src/components/action-sheet/usage/angular.md
Normal file
56
core/src/components/action-sheet/usage/angular.md
Normal file
@@ -0,0 +1,56 @@
|
||||
```javascript
|
||||
import { Component } from '@angular/core';
|
||||
import { ActionSheetController } from '@ionic/angular';
|
||||
|
||||
@Component({
|
||||
selector: 'action-sheet-example',
|
||||
templateUrl: 'action-sheet-example.html',
|
||||
styleUrls: ['./action-sheet-example.css'],
|
||||
})
|
||||
export class ActionSheetExample {
|
||||
|
||||
constructor(public actionSheetController: ActionSheetController) {}
|
||||
|
||||
presentActionSheet() {
|
||||
const actionSheet = this.actionSheetController.create({
|
||||
title: "Albums",
|
||||
buttons: [{
|
||||
text: 'Delete',
|
||||
role: 'destructive',
|
||||
icon: 'trash',
|
||||
handler: () => {
|
||||
console.log('Delete clicked');
|
||||
}
|
||||
}, {
|
||||
text: 'Share',
|
||||
icon: 'share',
|
||||
handler: () => {
|
||||
console.log('Share clicked');
|
||||
}
|
||||
}, {
|
||||
text: 'Play (open modal)',
|
||||
icon: 'arrow-dropright-circle',
|
||||
handler: () => {
|
||||
console.log('Play clicked');
|
||||
}
|
||||
}, {
|
||||
text: 'Favorite',
|
||||
icon: 'heart',
|
||||
handler: () => {
|
||||
console.log('Favorite clicked');
|
||||
}
|
||||
}, {
|
||||
text: 'Cancel',
|
||||
icon: 'close',
|
||||
role: 'cancel',
|
||||
handler: () => {
|
||||
console.log('Cancel clicked');
|
||||
}
|
||||
}]
|
||||
});
|
||||
|
||||
actionSheet.present();
|
||||
}
|
||||
|
||||
}
|
||||
```
|
||||
44
core/src/components/action-sheet/usage/javascript.md
Normal file
44
core/src/components/action-sheet/usage/javascript.md
Normal file
@@ -0,0 +1,44 @@
|
||||
```javascript
|
||||
async function presentActionSheet() {
|
||||
const actionSheetController = document.querySelector('ion-action-sheet-controller');
|
||||
await actionSheetController.componentOnReady();
|
||||
|
||||
const actionSheet = await actionSheetController.create({
|
||||
title: "Albums",
|
||||
buttons: [{
|
||||
text: 'Delete',
|
||||
role: 'destructive',
|
||||
icon: 'trash',
|
||||
handler: () => {
|
||||
console.log('Delete clicked');
|
||||
}
|
||||
}, {
|
||||
text: 'Share',
|
||||
icon: 'share',
|
||||
handler: () => {
|
||||
console.log('Share clicked');
|
||||
}
|
||||
}, {
|
||||
text: 'Play (open modal)',
|
||||
icon: 'arrow-dropright-circle',
|
||||
handler: () => {
|
||||
console.log('Play clicked');
|
||||
}
|
||||
}, {
|
||||
text: 'Favorite',
|
||||
icon: 'heart',
|
||||
handler: () => {
|
||||
console.log('Favorite clicked');
|
||||
}
|
||||
}, {
|
||||
text: 'Cancel',
|
||||
icon: 'close',
|
||||
role: 'cancel',
|
||||
handler: () => {
|
||||
console.log('Cancel clicked');
|
||||
}
|
||||
}]
|
||||
});
|
||||
await actionSheet.present();
|
||||
}
|
||||
```
|
||||
Reference in New Issue
Block a user