首页 > 解决方案 > 如何在 sapui5 中设计消息 Toast

问题描述

我想在 2 行而不是 1 行中显示消息 toast,我该怎么做?另外我需要设计它的不透明度,特定的颜色和尺寸?有什么想法吗? var message = this._oBundle.getText("Paymentdeclined"); sap.m.MessageToast.show(消息);

标签: javascriptcsssapui5message

解决方案


为了在换行中显示文本,您可以在需要换行符的地方包含换行符(\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 吐司。


推荐阅读