docs(action-sheet, alert, popover, toast): update usage to show onDidDismiss (#23133)

This commit is contained in:
William Martin
2021-04-02 13:00:36 -04:00
committed by GitHub
parent ef1a82f64a
commit b0d53ca736
20 changed files with 122 additions and 24 deletions

View File

@ -94,6 +94,9 @@ export class ActionSheetExample {
}]
});
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);
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();
const { role } = await actionSheet.onDidDismiss();
console.log('onDidDismiss resolved with role', role);
}
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);
},
},
});

View File

@ -50,6 +50,9 @@ export class ActionSheetExample {
}]
});
await actionSheet.present();
const { role } = await actionSheet.onDidDismiss();
console.log('onDidDismiss resolved with role', role);
}
}

View File

@ -38,6 +38,9 @@ async function presentActionSheet() {
}
}];
document.body.appendChild(actionSheet);
return actionSheet.present();
await actionSheet.present();
const { role } = await actionSheet.onDidDismiss();
console.log('onDidDismiss resolved with role', role);
}
```

View File

@ -47,6 +47,9 @@ export class ActionSheetExample {
}]
});
await actionSheet.present();
const { role } = await actionSheet.onDidDismiss();
console.log('onDidDismiss resolved with role', role);
}
render() {

View File

@ -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);
},
},
});

View File

@ -72,6 +72,9 @@ export class AlertExample {
});
await alert.present();
const { role } = await alert.onDidDismiss();
console.log('onDidDismiss resolved with role', role);
}
async presentAlertMultipleButtons() {
@ -381,7 +384,10 @@ function presentAlert() {
alert.buttons = ['OK'];
document.body.appendChild(alert);
return alert.present();
await alert.present();
const { role } = await alert.onDidDismiss();
console.log('onDidDismiss resolved with role', role);
}
function presentAlertMultipleButtons() {
@ -1031,6 +1037,9 @@ export class AlertExample {
});
await alert.present();
const { role } = await alert.onDidDismiss();
console.log('onDidDismiss resolved with role', role);
}
async presentAlertMultipleButtons() {
@ -1364,7 +1373,10 @@ export default defineComponent({
message: 'This is an alert message.',
buttons: ['OK'],
});
return alert.present();
await alert.present();
const { role } = await alert.onDidDismiss();
console.log('onDidDismiss resolved with role', role);
},
async presentAlertMultipleButtons() {

View File

@ -21,6 +21,9 @@ export class AlertExample {
});
await alert.present();
const { role } = await alert.onDidDismiss();
console.log('onDidDismiss resolved with role', role);
}
async presentAlertMultipleButtons() {

View File

@ -8,7 +8,10 @@ function presentAlert() {
alert.buttons = ['OK'];
document.body.appendChild(alert);
return alert.present();
await alert.present();
const { role } = await alert.onDidDismiss();
console.log('onDidDismiss resolved with role', role);
}
function presentAlertMultipleButtons() {

View File

@ -18,6 +18,9 @@ export class AlertExample {
});
await alert.present();
const { role } = await alert.onDidDismiss();
console.log('onDidDismiss resolved with role', role);
}
async presentAlertMultipleButtons() {

View File

@ -24,7 +24,10 @@ export default defineComponent({
message: 'This is an alert message.',
buttons: ['OK'],
});
return alert.present();
await alert.present();
const { role } = await alert.onDidDismiss();
console.log('onDidDismiss resolved with role', role);
},
async presentAlertMultipleButtons() {

View File

@ -62,7 +62,10 @@ export class PopoverExample {
event: ev,
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
});
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,
translucent: true
});
return await popover.present();
await popover.present();
const { role } = await popover.onDidDismiss();
console.log('onDidDismiss resolved with role', role);
}
render() {
@ -300,7 +310,10 @@ export default {
event: ev,
translucent: true
})
return popover.present();
await popover.present();
const { role } = await popover.onDidDismiss();
console.log('onDidDismiss resolved with role', role);
},
},
}

View File

@ -18,7 +18,10 @@ export class PopoverExample {
event: ev,
translucent: true
});
return await popover.present();
await popover.present();
const { role } = await popover.onDidDismiss();
console.log('onDidDismiss resolved with role', role);
}
}
```

View File

@ -29,6 +29,10 @@ function presentPopover(ev) {
translucent: true
});
document.body.appendChild(popover);
return popover.present();
await popover.present();
const { role } = await popover.onDidDismiss();
console.log('onDidDismiss resolved with role', role);
}
```

View File

@ -15,7 +15,10 @@ export class PopoverExample {
event: ev,
translucent: true
});
return await popover.present();
await popover.present();
const { role } = await popover.onDidDismiss();
console.log('onDidDismiss resolved with role', role);
}
render() {

View File

@ -40,7 +40,10 @@ export default {
event: ev,
translucent: true
})
return popover.present();
await popover.present();
const { role } = await popover.onDidDismiss();
console.log('onDidDismiss resolved with role', role);
},
},
}

View File

@ -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);
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() {
@ -306,7 +315,10 @@ export default {
}
]
})
return toast.present();
await toast.present();
const { role } = await toast.onDidDismiss();
console.log('onDidDismiss resolved with role', role);
},
},
}

View File

@ -41,7 +41,10 @@ export class ToastExample {
}
]
});
toast.present();
await toast.present();
const { role } = await toast.onDidDismiss();
console.log('onDidDismiss resolved with role', role);
}
}

View File

@ -31,6 +31,9 @@ async function presentToastWithOptions() {
];
document.body.appendChild(toast);
return toast.present();
await toast.present();
const { role } = await toast.onDidDismiss();
console.log('onDidDismiss resolved with role', role);
}
```

View File

@ -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() {

View File

@ -45,7 +45,10 @@ export default {
}
]
})
return toast.present();
await toast.present();
const { role } = await toast.onDidDismiss();
console.log('onDidDismiss resolved with role', role);
},
},
}