离子造型 2 吐司 [英] Styling ionic 2 toast
本文介绍了离子造型 2 吐司的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有没有办法在 ionic 2 toast 中设置文本消息的样式?
Is there any way to style the text message within an ionic 2 toast?
我试过这个:
let toast = Toast.create({
message: "Some text on one line. <br /><br /> Some text on another line.",
duration: 15000,
showCloseButton: true,
closeButtonText: 'Got it!',
dismissOnPageChange: true
});
toast.onDismiss(() => {
console.log('Dismissed toast');
});
this.nav.present(toast);
}
但显然你不能在文本中使用 html,所以我猜我的问题的答案是否定的?
But clearly you can't use html in the text so I am guessing the answer to my question is no?
推荐答案
您必须在 toastCtrl 函数中添加 'cssClass: "yourCssClassName"'.
You must add 'cssClass: "yourCssClassName"' in your toastCtrl function.
let toast = Toast.create({
message: "Some text on one line. <br /><br /> Some text on another line.",
duration: 15000,
showCloseButton: true,
closeButtonText: 'Got it!',
dismissOnPageChange: true,
cssClass: "yourCssClassName",
});
您可以向您的 css 类添加任何功能.但是您的 css 功能超出了默认页面的 css.例:
than you can add any feature to the your css class. But your css feature went outside the default page'css. Exmp:
page-your.page.scss.name {
//bla bla
}
.yourCssClassName {
text-align:center;
}
这篇关于离子造型 2 吐司的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文