有什么方法可以在 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,所以我猜我的问题的答案是否定的?
您必须在 toastCtrl 函数中添加 'cssClass: "yourCssClassName"'。
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 范围。示例:
page-your.page.scss.name {
//bla bla
}
.yourCssClassName {
text-align:center;
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)