我有一个旧的 ZendApplication (ZF1),现在我尝试将此应用程序转移到 ZF3。在应用程序中,我使用了一些 Dojo 元素,例如 Helpdialog。在 ZF3 中,Zend 不直接支持 Dojo,所以我直接使用 Dojo,而没有 Zend 交互。
因此,在我的布局视图中,我像这样加载 Dojo:
<script src="<?= $this->basePath()?>/assets/custom/js/dojo/dojo/dojo.js" data-dojo-config="async: true,isDebug: true,parseOnLoad: true">
require ([
'dijit/Dialog',
'dijit/form/Button',
'dijit/form/SimpleTextarea',
....
'dojox/widget/Standby',
'dojo/domReady!',
],)
);
这是我要使用的代码:
require (['dojo/domReady!','dijit/Dialog']);
function showHelp(id,help) {
dojo.xhrGet({
url: "http://localhost/NeuesProjekt/public/test/test",
//url:"http://localhost/NeuesProjekt/public/", // baseUrl + "/help/index/charkey/" + id,
load: function(data) {
helpDlg = new dijit.Dialog({
title: "help",
content: "data",
style: "width: 550px;"
});
helpDlg.show();
},
error: function(error) {
var data = "An unexpected error occurred: " + error;
helpDlg = new dijit.Dialog({
title: "help",
content: "data2",
style: "width: 550px"
});
helpDlg.show();
}
});
};
它会一直工作,直到应用程序到达new dijit.Dialog那里我得到错误dijit.dialog is not a constructor
我的错误在哪里?
编辑:在我看来,我在这样的锚点中调用函数:' href="javascript:showHelp('Help')">HELP'
EDIT2:我 F12 调试它告诉我没有定义对话框,但找到了 dijit。
jeck猫
胡说叔叔
相关分类