[UI5 常用控件] 10.MessageBox,MessageToast,Illustrated Message,Message Strip,Message View,MessagePopover

[UI5 常用控件] 10.MessageBox,MessageToast,Illustrated Message,Message Strip,Message View,MessagePopover

文章目录

前言1. MessageBox1.1 类型

2. MessageToast3. IllustratedMessage3.1 enableVerticalResponsiveness3.2 illustrationType3.3 illustrationSize3.4 additionalContent

4. MessageStrip5. MessageView5.1 视图里直接使用5.2 与Popover控件一起使用5.3 与Dialog控件一起使用

6. MessagePopover

前言

本章节记录常用控件 MessageBox,MessageToast,Illustrated Message,Message Strip,Message View,MessagePopover 其路径分别是:

sap.m.MessageBoxsap.m.MessageToastsap.m.IllustratedMessagesap.m.MessageStripsap.m.MessageViewsap.m.MessagePopover

1. MessageBox

此控件一般在Controller中使用。

用法

MessageBox.confirm("Message Here");

1.1 类型

confirm

alert

error

information

warning

success

Custom Action

onConfirmationMessageBoxPress: function () {

MessageBox.confirm("Approve purchase order 12345?");

},

onAlertMessageBoxPress: function () {

MessageBox.alert("The quantity you have reported exceeds the quantity planed.");

},

onErrorMessageBoxPress: function () {

MessageBox.error("Select a team in the \"Development\" area.\n\"Marketing\" isn't assigned to this area.");

},

onInfoMessageBoxPress: function () {

MessageBox.information("Your booking will be reserved for 24 hours.");

},

onWarningMessageBoxPress: function () {

MessageBox.warning("The project schedule was last updated over a year ago.");

},

onSuccessMessageBoxPress: function () {

MessageBox.success("Project 1234567 was created and assigned to team \"ABC\".");

},

onError2MessageBoxPress: function () {

MessageBox.error("Product A does not exist.", {

actions: ["Manage Products", MessageBox.Action.OK, MessageBox.Action.CLOSE],

emphasizedAction: "Manage Products",

initialFocus: "Manage Products",

details: "

This can happen if:

" +

"

    " +

    "

  • You are not connected to the internet
  • " +

    "

  • a backend component is not available
  • " +

    "

  • or an underlying system is down
  • " +

    "

" +

"

Get more help here.",

onClose: function (sAction) {

sap.m.MessageToast.show("Action selected: " + sAction);

}

});

},

2. MessageToast

Code

onMessageToastPress:function(){

MessageToast.show("Message Toast Clicked");

}

3. IllustratedMessage

IllustratedMessage是一个用于显示带有图标的消息的UI5控件。 它提供了一种可视化的方式来向用户传达信息,并可以帮助用户更好地理解和处理消息。

3.1 enableVerticalResponsiveness

排列布局

enableVerticalResponsiveness="true"

illustrationType="sapIllus-NoMail"

/>

enableVerticalResponsiveness="false"

illustrationType="sapIllus-NoMail"

/>

3.2 illustrationType

预定义的图标样式及文字

3.3 illustrationSize

属性有:Auto,Base,Spot,Dialog,Dot,Scene

3.4 additionalContent

IllustratedMessage内部创建额外的控件

Code

enableVerticalResponsiveness="true"

illustrationType="sapIllus-NoActivities"

>

相关推荐