在SAPUI5的JavaScript对话框中添加关闭按钮,可以通过以下步骤实现:
var oDialog = new sap.m.Dialog({
title: "对话框标题",
content: [
new sap.m.Text({
text: "对话框内容"
})
]
});
var oCloseButton = new sap.m.Button({
text: "关闭",
press: function() {
oDialog.close();
}
});
oDialog.setEndButton(oCloseButton);
oDialog.open();
完整的代码示例如下:
var oDialog = new sap.m.Dialog({
title: "对话框标题",
content: [
new sap.m.Text({
text: "对话框内容"
})
]
});
var oCloseButton = new sap.m.Button({
text: "关闭",
press: function() {
oDialog.close();
}
});
oDialog.setEndButton(oCloseButton);
oDialog.open();
这样就在SAPUI5的JavaScript对话框中成功添加了关闭按钮。关闭按钮的点击事件处理程序会关闭对话框。
领取专属 10元无门槛券
手把手带您无忧上云