如何在sapui5中设计消息Toast

问题描述

我想以2行而不是1条显示消息吐司 我怎么做? 另外,我需要设计不透明度,特定颜色和尺寸较小的产品吗? 有任何想法吗? var message = this._oBundle.getText(“ Paymentdeclined”); sap.m.Messagetoast.show(message);

解决方法

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