subHeader
可以使用自定义 CSS 类加粗。在这个例子中是alertCustomClass
。

主页.ts
async presentAlertConfirm() {
const alert = await this.alertController.create({
header: 'About ' + this.test,
subHeader: this.test,
message: 'About ' + '<strong>' + this.test + '</strong>',
cssClass: 'alertCustomClass',
buttons: [
{
text: 'Cancel',
role: 'cancel',
cssClass: 'secondary',
handler: (blah) => {
console.log('Confirm Cancel: blah');
}
}, {
text: 'Okay',
handler: () => {
console.log('Confirm Okay');
}
}
]
});
await alert.present();
}
全局.scss
.alertCustomClass {
.alert-sub-title {
font-weight: bold;
}
}
此外,您可以像这样message
使用粗体:<strong>
async presentAlertConfirm() {
const alert = await this.alertController.create({
header: 'Confirm!',
message: 'About ' + '<strong>' + this.user.name + '</strong>',
buttons: [
{
text: 'Cancel',
role: 'cancel',
cssClass: 'secondary',
handler: (blah) => {
console.log('Confirm Cancel: blah');
}
}, {
text: 'Okay',
handler: () => {
console.log('Confirm Okay');
}
}
]
});
await alert.present();
}
header
font-weight:500;
默认为粗体 ( )。
...
header: 'About ' + this.user.name,
message: ...,
buttons: ,,,.
...