mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-10 00:27:41 +08:00
docs(action-sheet, alert, popover, toast): update usage to show onDidDismiss (#23133)
This commit is contained in:
@ -94,6 +94,9 @@ export class ActionSheetExample {
|
|||||||
}]
|
}]
|
||||||
});
|
});
|
||||||
await actionSheet.present();
|
await actionSheet.present();
|
||||||
|
|
||||||
|
const { role } = await actionSheet.onDidDismiss();
|
||||||
|
console.log('onDidDismiss resolved with role', role);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -147,7 +150,10 @@ async function presentActionSheet() {
|
|||||||
}
|
}
|
||||||
}];
|
}];
|
||||||
document.body.appendChild(actionSheet);
|
document.body.appendChild(actionSheet);
|
||||||
return actionSheet.present();
|
await actionSheet.present();
|
||||||
|
|
||||||
|
const { role } = await actionSheet.onDidDismiss();
|
||||||
|
console.log('onDidDismiss resolved with role', role);
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -316,6 +322,9 @@ export class ActionSheetExample {
|
|||||||
}]
|
}]
|
||||||
});
|
});
|
||||||
await actionSheet.present();
|
await actionSheet.present();
|
||||||
|
|
||||||
|
const { role } = await actionSheet.onDidDismiss();
|
||||||
|
console.log('onDidDismiss resolved with role', role);
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
@ -389,7 +398,10 @@ export default defineComponent({
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
return actionSheet.present();
|
await actionSheet.present();
|
||||||
|
|
||||||
|
const { role } = await actionSheet.onDidDismiss();
|
||||||
|
console.log('onDidDismiss resolved with role', role);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@ -50,6 +50,9 @@ export class ActionSheetExample {
|
|||||||
}]
|
}]
|
||||||
});
|
});
|
||||||
await actionSheet.present();
|
await actionSheet.present();
|
||||||
|
|
||||||
|
const { role } = await actionSheet.onDidDismiss();
|
||||||
|
console.log('onDidDismiss resolved with role', role);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -38,6 +38,9 @@ async function presentActionSheet() {
|
|||||||
}
|
}
|
||||||
}];
|
}];
|
||||||
document.body.appendChild(actionSheet);
|
document.body.appendChild(actionSheet);
|
||||||
return actionSheet.present();
|
await actionSheet.present();
|
||||||
|
|
||||||
|
const { role } = await actionSheet.onDidDismiss();
|
||||||
|
console.log('onDidDismiss resolved with role', role);
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|||||||
@ -47,6 +47,9 @@ export class ActionSheetExample {
|
|||||||
}]
|
}]
|
||||||
});
|
});
|
||||||
await actionSheet.present();
|
await actionSheet.present();
|
||||||
|
|
||||||
|
const { role } = await actionSheet.onDidDismiss();
|
||||||
|
console.log('onDidDismiss resolved with role', role);
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
|||||||
@ -56,7 +56,10 @@ export default defineComponent({
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
return actionSheet.present();
|
await actionSheet.present();
|
||||||
|
|
||||||
|
const { role } = await actionSheet.onDidDismiss();
|
||||||
|
console.log('onDidDismiss resolved with role', role);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@ -72,6 +72,9 @@ export class AlertExample {
|
|||||||
});
|
});
|
||||||
|
|
||||||
await alert.present();
|
await alert.present();
|
||||||
|
|
||||||
|
const { role } = await alert.onDidDismiss();
|
||||||
|
console.log('onDidDismiss resolved with role', role);
|
||||||
}
|
}
|
||||||
|
|
||||||
async presentAlertMultipleButtons() {
|
async presentAlertMultipleButtons() {
|
||||||
@ -381,7 +384,10 @@ function presentAlert() {
|
|||||||
alert.buttons = ['OK'];
|
alert.buttons = ['OK'];
|
||||||
|
|
||||||
document.body.appendChild(alert);
|
document.body.appendChild(alert);
|
||||||
return alert.present();
|
await alert.present();
|
||||||
|
|
||||||
|
const { role } = await alert.onDidDismiss();
|
||||||
|
console.log('onDidDismiss resolved with role', role);
|
||||||
}
|
}
|
||||||
|
|
||||||
function presentAlertMultipleButtons() {
|
function presentAlertMultipleButtons() {
|
||||||
@ -1031,6 +1037,9 @@ export class AlertExample {
|
|||||||
});
|
});
|
||||||
|
|
||||||
await alert.present();
|
await alert.present();
|
||||||
|
|
||||||
|
const { role } = await alert.onDidDismiss();
|
||||||
|
console.log('onDidDismiss resolved with role', role);
|
||||||
}
|
}
|
||||||
|
|
||||||
async presentAlertMultipleButtons() {
|
async presentAlertMultipleButtons() {
|
||||||
@ -1364,7 +1373,10 @@ export default defineComponent({
|
|||||||
message: 'This is an alert message.',
|
message: 'This is an alert message.',
|
||||||
buttons: ['OK'],
|
buttons: ['OK'],
|
||||||
});
|
});
|
||||||
return alert.present();
|
await alert.present();
|
||||||
|
|
||||||
|
const { role } = await alert.onDidDismiss();
|
||||||
|
console.log('onDidDismiss resolved with role', role);
|
||||||
},
|
},
|
||||||
|
|
||||||
async presentAlertMultipleButtons() {
|
async presentAlertMultipleButtons() {
|
||||||
|
|||||||
@ -21,6 +21,9 @@ export class AlertExample {
|
|||||||
});
|
});
|
||||||
|
|
||||||
await alert.present();
|
await alert.present();
|
||||||
|
|
||||||
|
const { role } = await alert.onDidDismiss();
|
||||||
|
console.log('onDidDismiss resolved with role', role);
|
||||||
}
|
}
|
||||||
|
|
||||||
async presentAlertMultipleButtons() {
|
async presentAlertMultipleButtons() {
|
||||||
|
|||||||
@ -8,7 +8,10 @@ function presentAlert() {
|
|||||||
alert.buttons = ['OK'];
|
alert.buttons = ['OK'];
|
||||||
|
|
||||||
document.body.appendChild(alert);
|
document.body.appendChild(alert);
|
||||||
return alert.present();
|
await alert.present();
|
||||||
|
|
||||||
|
const { role } = await alert.onDidDismiss();
|
||||||
|
console.log('onDidDismiss resolved with role', role);
|
||||||
}
|
}
|
||||||
|
|
||||||
function presentAlertMultipleButtons() {
|
function presentAlertMultipleButtons() {
|
||||||
|
|||||||
@ -18,6 +18,9 @@ export class AlertExample {
|
|||||||
});
|
});
|
||||||
|
|
||||||
await alert.present();
|
await alert.present();
|
||||||
|
|
||||||
|
const { role } = await alert.onDidDismiss();
|
||||||
|
console.log('onDidDismiss resolved with role', role);
|
||||||
}
|
}
|
||||||
|
|
||||||
async presentAlertMultipleButtons() {
|
async presentAlertMultipleButtons() {
|
||||||
|
|||||||
@ -24,7 +24,10 @@ export default defineComponent({
|
|||||||
message: 'This is an alert message.',
|
message: 'This is an alert message.',
|
||||||
buttons: ['OK'],
|
buttons: ['OK'],
|
||||||
});
|
});
|
||||||
return alert.present();
|
await alert.present();
|
||||||
|
|
||||||
|
const { role } = await alert.onDidDismiss();
|
||||||
|
console.log('onDidDismiss resolved with role', role);
|
||||||
},
|
},
|
||||||
|
|
||||||
async presentAlertMultipleButtons() {
|
async presentAlertMultipleButtons() {
|
||||||
|
|||||||
@ -62,7 +62,10 @@ export class PopoverExample {
|
|||||||
event: ev,
|
event: ev,
|
||||||
translucent: true
|
translucent: true
|
||||||
});
|
});
|
||||||
return await popover.present();
|
await popover.present();
|
||||||
|
|
||||||
|
const { role } = await popover.onDidDismiss();
|
||||||
|
console.log('onDidDismiss resolved with role', role);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
@ -106,7 +109,11 @@ function presentPopover(ev) {
|
|||||||
translucent: true
|
translucent: true
|
||||||
});
|
});
|
||||||
document.body.appendChild(popover);
|
document.body.appendChild(popover);
|
||||||
return popover.present();
|
|
||||||
|
await popover.present();
|
||||||
|
|
||||||
|
const { role } = await popover.onDidDismiss();
|
||||||
|
console.log('onDidDismiss resolved with role', role);
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -216,7 +223,10 @@ export class PopoverExample {
|
|||||||
event: ev,
|
event: ev,
|
||||||
translucent: true
|
translucent: true
|
||||||
});
|
});
|
||||||
return await popover.present();
|
await popover.present();
|
||||||
|
|
||||||
|
const { role } = await popover.onDidDismiss();
|
||||||
|
console.log('onDidDismiss resolved with role', role);
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
@ -300,7 +310,10 @@ export default {
|
|||||||
event: ev,
|
event: ev,
|
||||||
translucent: true
|
translucent: true
|
||||||
})
|
})
|
||||||
return popover.present();
|
await popover.present();
|
||||||
|
|
||||||
|
const { role } = await popover.onDidDismiss();
|
||||||
|
console.log('onDidDismiss resolved with role', role);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@ -18,7 +18,10 @@ export class PopoverExample {
|
|||||||
event: ev,
|
event: ev,
|
||||||
translucent: true
|
translucent: true
|
||||||
});
|
});
|
||||||
return await popover.present();
|
await popover.present();
|
||||||
|
|
||||||
|
const { role } = await popover.onDidDismiss();
|
||||||
|
console.log('onDidDismiss resolved with role', role);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|||||||
@ -29,6 +29,10 @@ function presentPopover(ev) {
|
|||||||
translucent: true
|
translucent: true
|
||||||
});
|
});
|
||||||
document.body.appendChild(popover);
|
document.body.appendChild(popover);
|
||||||
return popover.present();
|
|
||||||
|
await popover.present();
|
||||||
|
|
||||||
|
const { role } = await popover.onDidDismiss();
|
||||||
|
console.log('onDidDismiss resolved with role', role);
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|||||||
@ -15,7 +15,10 @@ export class PopoverExample {
|
|||||||
event: ev,
|
event: ev,
|
||||||
translucent: true
|
translucent: true
|
||||||
});
|
});
|
||||||
return await popover.present();
|
await popover.present();
|
||||||
|
|
||||||
|
const { role } = await popover.onDidDismiss();
|
||||||
|
console.log('onDidDismiss resolved with role', role);
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
|||||||
@ -40,7 +40,10 @@ export default {
|
|||||||
event: ev,
|
event: ev,
|
||||||
translucent: true
|
translucent: true
|
||||||
})
|
})
|
||||||
return popover.present();
|
await popover.present();
|
||||||
|
|
||||||
|
const { role } = await popover.onDidDismiss();
|
||||||
|
console.log('onDidDismiss resolved with role', role);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@ -61,7 +61,10 @@ export class ToastExample {
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
toast.present();
|
await toast.present();
|
||||||
|
|
||||||
|
const { role } = await toast.onDidDismiss();
|
||||||
|
console.log('onDidDismiss resolved with role', role);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -103,7 +106,10 @@ async function presentToastWithOptions() {
|
|||||||
];
|
];
|
||||||
|
|
||||||
document.body.appendChild(toast);
|
document.body.appendChild(toast);
|
||||||
return toast.present();
|
await toast.present();
|
||||||
|
|
||||||
|
const { role } = await toast.onDidDismiss();
|
||||||
|
console.log('onDidDismiss resolved with role', role);
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -242,7 +248,10 @@ export class ToastExample {
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
toast.present();
|
await toast.present();
|
||||||
|
|
||||||
|
const { role } = await toast.onDidDismiss();
|
||||||
|
console.log('onDidDismiss resolved with role', role);
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
@ -306,7 +315,10 @@ export default {
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
return toast.present();
|
await toast.present();
|
||||||
|
|
||||||
|
const { role } = await toast.onDidDismiss();
|
||||||
|
console.log('onDidDismiss resolved with role', role);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@ -41,7 +41,10 @@ export class ToastExample {
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
toast.present();
|
await toast.present();
|
||||||
|
|
||||||
|
const { role } = await toast.onDidDismiss();
|
||||||
|
console.log('onDidDismiss resolved with role', role);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -31,6 +31,9 @@ async function presentToastWithOptions() {
|
|||||||
];
|
];
|
||||||
|
|
||||||
document.body.appendChild(toast);
|
document.body.appendChild(toast);
|
||||||
return toast.present();
|
await toast.present();
|
||||||
|
|
||||||
|
const { role } = await toast.onDidDismiss();
|
||||||
|
console.log('onDidDismiss resolved with role', role);
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|||||||
@ -38,7 +38,10 @@ export class ToastExample {
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
toast.present();
|
await toast.present();
|
||||||
|
|
||||||
|
const { role } = await toast.onDidDismiss();
|
||||||
|
console.log('onDidDismiss resolved with role', role);
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
|||||||
@ -45,7 +45,10 @@ export default {
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
return toast.present();
|
await toast.present();
|
||||||
|
|
||||||
|
const { role } = await toast.onDidDismiss();
|
||||||
|
console.log('onDidDismiss resolved with role', role);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user