所需的模块缺少方法 [英] Required module missing methods

查看:47
本文介绍了所需的模块缺少方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是 UI5 (1.60.2) 的错误还是我在这里做错了什么?

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)
在 f.onSelectPreferredTreatment (Preview.controller.js?eval:552)

解决方案

检查控制器中的依赖项列表.所需模块的顺序应准确反映回调函数可用参数的顺序.

sap.ui.define(["sap/ui/core/mvc/Controller",//1st"sap/m/Dialog",//第二个//...], 函数(控制器/*1st*/, Dialog/*2nd, ...*/){//...});

您可能还需要两次模块,类似于 https://stackoverflow.com/a/55289688/5846045

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)

解决方案

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

这篇关于所需的模块缺少方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆