问题
Is it a bug from UI5 (1.60.2) or I am doing something wrong here?
onSelectPreferredTreatment: function(event) {
// ...
const oDialog = new Dialog({/*...*/});
oDialog.open();
},
VM77446:1 Uncaught TypeError: oDialog.open is not a function
at eval (eval at onSelectPreferredTreatment (Preview.controller.js?eval:NaN), :1:9)
at f.onSelectPreferredTreatment (Preview.controller.js?eval:552)
回答1:
Check the dependency list in your controller. The order of the required modules should reflect the order of available parameters of the callback function exactly.
sap.ui.define([
"sap/ui/core/mvc/Controller", // 1st
"sap/m/Dialog", // 2nd
// ...
], function(Controller/*1st*/, Dialog/*2nd, ...*/) {
// ...
});
You might also have required some modules twice, similar to https://stackoverflow.com/a/55289688/5846045
来源:https://stackoverflow.com/questions/61120143/required-module-missing-methods