下面的代码是从 UI5 演示套件复制的,但是当我运行它时,控制台显示该函数的错误消息Fragment.load
不是一个函数。请提出任何替代方案或突出显示问题(如果有)。
sap.ui.define([
"sap/ui/core/mvc/Controller",
"sap/m/MessageToast",
"sap/ui/model/Filter",
"sap/ui/model/FilterOperator",
"sap/ui/model/json/JSONModel",
"sap/m/MessageToast",
"sap/ui/core/Fragment"
], function(Controller, MessageToast, Filter, FilterOperator, JSONModel, Fragment) {
"use strict";
return Controller.extend("Workspace.controller.HelloPanel", {
onInit: function() {
var plant = {
pid: "",
ptype: "",
pdesc: "",
psite: "",
pstatus: "",
passigned: "",
pattach: ""
};
var oModel1 = new JSONModel(plant);
this.getView().setModel(oModel1, "SUP");
},
onOpenDialog: function() {
var oView = this.getView();
if (!this.byId("helloDialog")) {
Fragment.load({
id: oView.getId(),
name: "Workspace.view.HelloDialog",
controller: this
}).then(function(oDialog) {
// connect dialog to the root view of this component (models, lifecycle)
oView.addDependent(oDialog);
oDialog.open();
});
} else {
this.byId("helloDialog").open();
}
},
onCloseDialog: function() {
this.byId("helloDialog").close();
},
});
});