gpt4 book ai didi

toast - ionic 造型 2 toast

转载 作者:行者123 更新时间:2023-12-03 12:00:43 27 4
gpt4 key购买 nike

有没有办法在 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;
}

关于toast - ionic 造型 2 toast ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37118385/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com