javascript - 如何在 sapui5 中设计消息 Toast
问题描述
我想在 2 行而不是 1 行中显示消息 toast,我该怎么做?另外我需要设计它的不透明度,特定的颜色和尺寸?有什么想法吗? var message = this._oBundle.getText("Paymentdeclined"); sap.m.MessageToast.show(消息);
解决方案
为了在换行中显示文本,您可以在需要换行符的地方包含换行符(\n)。为了改变 MessageToast 的不透明度和颜色,您需要应用您的自定义 CSS。例子 :-
sap.m.MessageToast.show('Lorem \n ipsum \n dolor sit amet', {
duration: 3000,
width: "15rem", // default max width supported
});
/* width properties are required only if the width required is more than 15rem*/
.sapMMessageToast{
background : #629192 !important;
width:25rem !important;
max-width : 25rem !important;
opacity: 0.5 !important;
}
但请记住,这将应用于所有 MessageToast 吐司。
推荐阅读
- java - Java for 循环是否定的
- html - 如何一次滚动一个单独的文本和背景图像
- internet-explorer - 让 IE 信任从 Mac 启动的网站
- python - 程序不会在 for 循环中对名为 L 的字典的键映射值求和
- c - 将有符号转换为无符号,反之亦然,同时扩大字节数
- python - 如何为使用“for”循环实例化的类实例命名?
- or-tools - 修改 google ortools vrptw 示例失败
- cmake - VSOME/IP 问题:我无法完成 CMake
- java - 如何将此 while 循环转换为 for 循环?
- docker - docker-compose 错误“找不到指定的 Dockerfile:Dockerfile”