如果我打开两个对话框
dialogBusy = new sap.m.BusyDialog();
dialogBusy.setShowCancelButton(true);
dialogBusy.setTitle("1");
dialogBusy.open();
dialogBusy = new sap.m.BusyDialog();
dialogBusy.setShowCancelButton(true);
dialogBusy.setTitle("2");
dialogBusy.open();
dialogBusy.close();
//dialogBusy.close();
当我调用close函数时,我只关闭了第二个对话框(正确)。
使用两个不同的对话框实例。
<script src="https://openui5.hana.ondemand.com/resources/sap-ui-core.js" id="sap-ui-bootstrap" data-sap-ui-theme="sap_bluecrystal" data-sap-ui-libs="sap.m,sap.ui.commons"></script>
<script>
var dialogBusy = new sap.m.BusyDialog();
dialogBusy.setShowCancelButton(true);
dialogBusy.setTitle("1");
dialogBusy.open();
var dialogBusy2 = new sap.m.BusyDialog();
dialogBusy2.setShowCancelButton(true);
dialogBusy2.setTitle("2");
dialogBusy2.open();
setTimeout(function() {
dialogBusy.close();
}, 2000);
setTimeout(function() {
dialogBusy2.close();
}, 1000);
</script>
对话框可以方便地用以下方法关闭 sap/m/InstanceManager.closeAllDialogs
.
// InstanceManager required from "sap/m/InstanceManager"
InstanceManager.closeAllDialogs(/*fnAfterClose?*/));