摇曳的蔷薇
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: ,,,....