我想在 ionic 4 中提供警报控制器样式。这些是我的演示代码,
async presentalert() {
const alert = await this.alertCtrl.create({
header: ' DO YOU WANT TO CANCEL',
message: 'DO YOU WANT TO CANCEL',
cssClass: 'alertCancel',
mode: 'ios',
buttons: [
{
text: 'NO',
role: 'cancel',
cssClass: 'alertButton',
handler: () => {
console.log('Confirm Cancel');
}
}, {
text: 'YES',
cssClass: 'alertButton',
handler: () => {
console.log('Confirm Okay');
}
}
]
})
await alert.present();
}
我尝试在 global.scss 中应用 scss
.alertCancel{
--background: red;
}
.alertButton {
background-color: white !important;
}
我已经尝试了一切可能的方法来在警报控制器中提供CSS,但它不起作用,所以请帮助我,我被困在这里。
--background
是组件的css变量ion-alert
,因此在variables.scss
ion-alert
{
--background: red !important;
}
以供参考:
https://ionicframework.com/docs/theming/css-variables#ionic-variables https://ionicframework.com/docs/theming/css-variables#ionic-variables
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)