mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
fix(action-sheet): add button-inner wrapper to cancel button
This commit is contained in:
@@ -292,13 +292,15 @@ export class ActionSheet {
|
||||
class={this.buttonClass(cancelButton)}
|
||||
onClick={() => this.buttonClick(cancelButton)}
|
||||
>
|
||||
{cancelButton.icon
|
||||
? <ion-icon
|
||||
name={cancelButton.icon}
|
||||
class='action-sheet-icon'
|
||||
/>
|
||||
: null}
|
||||
{cancelButton.text}
|
||||
<span class='button-inner'>
|
||||
{cancelButton.icon
|
||||
? <ion-icon
|
||||
name={cancelButton.icon}
|
||||
class='action-sheet-icon'
|
||||
/>
|
||||
: null}
|
||||
{cancelButton.text}
|
||||
</span>
|
||||
</button>
|
||||
|
||||
</div>
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
<ion-action-sheet-controller></ion-action-sheet-controller>
|
||||
|
||||
<ion-button expand="block" id="basic" onclick="presentBasic()">Basic</ion-button>
|
||||
<ion-button expand="block" id="icons" onclick="presentIcons()">Icons</ion-button>
|
||||
<ion-button expand="block" id="noBackdropDismiss" onclick="presentNoBackdropDismiss()">No Backdrop Dismiss</ion-button>
|
||||
<ion-button expand="block" id="alertFromActionSheet" onclick="presentAlert()">Alert from Action Sheet</ion-button>
|
||||
<ion-button expand="block" id="scrollableOptions" onclick="presentScroll()">Scrollable Options</ion-button>
|
||||
@@ -37,6 +38,45 @@
|
||||
async function presentBasic() {
|
||||
const mode = Ionic.mode;
|
||||
|
||||
const actionSheetController = document.querySelector('ion-action-sheet-controller');
|
||||
await actionSheetController.componentOnReady();
|
||||
const actionSheetElement = await actionSheetController.create({
|
||||
title: "Albums",
|
||||
buttons: [{
|
||||
text: 'Delete',
|
||||
role: 'destructive',
|
||||
handler: () => {
|
||||
console.log('Delete clicked');
|
||||
}
|
||||
}, {
|
||||
text: 'Share',
|
||||
handler: () => {
|
||||
console.log('Share clicked');
|
||||
}
|
||||
}, {
|
||||
text: 'Play (open modal)',
|
||||
handler: () => {
|
||||
console.log('Play clicked');
|
||||
}
|
||||
}, {
|
||||
text: 'Favorite',
|
||||
handler: () => {
|
||||
console.log('Favorite clicked');
|
||||
}
|
||||
}, {
|
||||
text: 'Cancel',
|
||||
role: 'cancel',
|
||||
handler: () => {
|
||||
console.log('Cancel clicked');
|
||||
}
|
||||
}]
|
||||
})
|
||||
await actionSheetElement.present();
|
||||
}
|
||||
|
||||
async function presentIcons() {
|
||||
const mode = Ionic.mode;
|
||||
|
||||
const actionSheetController = document.querySelector('ion-action-sheet-controller');
|
||||
await actionSheetController.componentOnReady();
|
||||
const actionSheetElement = await actionSheetController.create({
|
||||
@@ -62,14 +102,14 @@
|
||||
}
|
||||
}, {
|
||||
text: 'Favorite',
|
||||
icon: mode !== 'ios' ? 'heart' : null,
|
||||
icon: 'heart',
|
||||
handler: () => {
|
||||
console.log('Favorite clicked');
|
||||
}
|
||||
}, {
|
||||
text: 'Cancel',
|
||||
role: 'cancel',
|
||||
icon: mode !== 'ios' ? 'close' : null,
|
||||
icon: 'close',
|
||||
handler: () => {
|
||||
console.log('Cancel clicked');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user