我想为我的警报控制器应用css属性,但是不起作用。
home.html
<ion-select [(ngModel)]="accountSystem" placeholder="Match Accounting Standard" okText="Done" cancelText="Cancel" class="select-account">
<ion-select-option value="PRC Gaap">PRC Gaap</ion-select-option>
<ion-select-option value="IFRS">IFRS</ion-select-option>
<ion-select-option value="US Gaap">US Gaap</ion-select-option>
</ion-select>
global.scss
.select-account{
.alert-wrapper{
.alert-button-inner{
color:rgb(239,52,52);
}
.alert-button{
color:rgb(52,223,57);
}
}}
答案 0 :(得分:1)
这是我在项目中的可行解决方案。
home.ts
const alert = await this.alertCtrl.create({
header: "Alert",
mode: "ios",
cssClass: "codealert",
buttons: [
{
text: 'Cancel',
role: 'cancel',
cssClass: 'alertbutton',
handler: () => {
console.log('Confirm Cancel');
}
}, {
text: 'Ok',
cssClass: 'alertbutton',
handler: () => {
console.log('Confirm Ok');
}
}
]
});
await alert.present();
}
global.scss
.codealert {
--background: white;
}
.alertbutton {
color: #600001 !important;
font-weight: bold;
}