Ari*_*jit 5 typescript ionic-framework ionic3 angular
我遵循了官方文档,我的代码如下:
let alert = this.alertCtrl.create({
title: 'Alert',
subTitle: 'Subtitle',
message: 'This is an alert message.',
buttons: ['OK'],
cssClass: 'profalert'
});
alert.present();
Run Code Online (Sandbox Code Playgroud)
和我的 CSS:
.profalert{
color:#e7333c;
background-color: red;
}
Run Code Online (Sandbox Code Playgroud)
但这并没有改变警报框的颜色。我也试过alert .setCssClass('profalert');
我已经检查过这个
它工作正常。你只需要在app.scss文件中声明它。
应用程序.scss
.profalert{
color:#e7333c;
background-color: red;
}
Run Code Online (Sandbox Code Playgroud)
结果:
当我将您的样式应用于我的应用程序的警报框时:
.profalert{
color:#e7333c;
background-color: red;
}
Run Code Online (Sandbox Code Playgroud)
到global.scss
如果对警报控制按钮的水平对齐感兴趣,请在此处查看我的答案
如果您要从旧版本迁移到 ionic 4.x,请查看此repo 以了解重大更改。
| 归档时间: |
|
| 查看次数: |
5316 次 |
| 最近记录: |