这是我创建的吐司:
const toast = await this.toast.create({
showCloseButton: true,
message: 'Please Fill Data',
duration: 30000,
position: 'bottom',
cssClass:'iontoast'
});
toast.present();
Run Code Online (Sandbox Code Playgroud)
我应用的样式:
iontoast{
.toast-message{
--background:white !important;
--color:black !important;
}
.toast-container
{
--background:white !important;
--color:black !important;
}
}
Run Code Online (Sandbox Code Playgroud)
我也试过这个:
ion-toast{
--background:white !important;
--color:black !important;
}
Run Code Online (Sandbox Code Playgroud)
他们两个都没有为我工作。我应该如何将它应用于android和ios?谢谢!
await this.toastController.create({
message: 'Hello World',
color: 'danger',
duration: 2000,
position: 'top',
showCloseButton: true,
closeButtonText: 'Close'
});
Run Code Online (Sandbox Code Playgroud)
您可以传递任何其他颜色以及主题/variable.scss 文件中提供的主要、次要、成功等。
ion-toast.my_custom_class {
// Css rules or using css custom properties
}
Run Code Online (Sandbox Code Playgroud)
并将您的自定义类名传递给 toast 控制器
| 归档时间: |
|
| 查看次数: |
5315 次 |
| 最近记录: |