在警报离子4上传递html模板和图标 [英] passing html template and icons on alert ionic 4
本文介绍了在警报离子4上传递html模板和图标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我一直在尝试实现ionic 4中的上述功能,但对我来说似乎没有希望,因为我只能使用输入而不是自定义HTML&图标已通过警报传递.关于如何实现这一目标的任何想法
I have been trying to achieve something like the above in ionic 4 but it seems like there is no hope for me cos it seems I can only use inputs and not a custom HTML & icons been passed on the alert. any idea on how to achieve this pls
async presentColor() {
const alert = await this.alertController.create({
header: "Choose Color",
inputs: [
{
name: "Red",
type: "checkbox",
label: "Red",
value: "Red",
checked: true
},
{
name: "Black",
type: "checkbox",
label: "Black",
value: "Black"
},
{
name: "purple",
type: "checkbox",
label: "Purple",
value: "Purple"
}
],
buttons: [
{
text: "Cancel",
role: "cancel",
cssClass: "secondary",
handler: (data) => {
console.log("Confirm Cancel", data);
}
},
{
text: "Ok",
handler: () => {
console.log("Confirm Ok");
}
}
]
});
推荐答案
Ionic团队尚未使警报组件易于自定义,因此可以将图标添加到警报组件中.查看问题:
The Ionic team has not made alert components easily customizable so icons can be added to the alert component. See issue:
https://github.com/ionic-team/ionic/issues/7874
但是您可以轻松创建模态组件并将其大小减小到更接近警报对话框的大小.
But you could easily create a modal component and reduce its size to be closer to that of the alert dialog box.
这篇关于在警报离子4上传递html模板和图标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文