我可以在 SAP UI5 的标准消息框中提供链接吗?

是否可以在 sap ui5 的标准消息框中提供链接而不是消息?我想通过单击该链接导航到另一个视图。是否可以在不创建新片段并在标准消息框中添加内容的情况下实现?



慕码人2483693
浏览 148回答 2
2回答

慕容森

我遇到了同样的问题,并找到了以下解决方案:if (!this.oSuccessMessageDialog) {&nbsp; &nbsp; this.oSuccessMessageDialog = new sap.m.Dialog({&nbsp; &nbsp; &nbsp; &nbsp; type: sap.m.DialogType.Message,&nbsp; &nbsp; &nbsp; &nbsp; title: "Success",&nbsp; &nbsp; &nbsp; &nbsp; state: sap.ui.core.ValueState.Success,&nbsp; &nbsp; &nbsp; &nbsp; content: [&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; new sap.m.Text({ text: "Click on\u00a0" }),&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; new sap.m.Link({&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; text: "this",&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; emphasized: true,&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; press: <your_handler>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }),&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; new sap.m.Text({ text: "\u00a0Link." })&nbsp; &nbsp; &nbsp; &nbsp; ],&nbsp; &nbsp; &nbsp; &nbsp; beginButton: new sap.m.Button({&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; type: sap.m.ButtonType.Emphasized,&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; text: "OK",&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; press: function () {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.oSuccessMessageDialog.close();&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }.bind(this)&nbsp; &nbsp; &nbsp; &nbsp; })&nbsp; &nbsp; });}this.oSuccessMessageDialog.open();

萧十郎

sap.m.MessageBox 不允许链接,但使用自定义操作。只需查看带有自定义操作的示例错误。也许这会对你有所帮助。
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JavaScript