错误:来自Dojo& jQuery-UI冲突 [英] Error: multipleDefine from Dojo & jQuery-UI conflict

查看:371
本文介绍了错误:来自Dojo& jQuery-UI冲突的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试创建一个可编辑的SlickGrid(使用jquery-ui)并且还使用Dojo。

I am trying to create an editable SlickGrid (which uses jquery-ui) and also use Dojo.

当我的页面包含

< script src =../../ bower_components / dojo / dojo.js>< / script>

< script src =../../ bower_components / SlickGrid / lib / jquery-ui-1.11.3.js>< / script>

< script src =../../ mlads / fillDemo / FillDemo.js>< / script>

控制台显示

When my page contains
<script src="../../bower_components/dojo/dojo.js"></script>
<script src="../../bower_components/SlickGrid/lib/jquery-ui-1.11.3.js"></script>
<script src="../../mlads/fillDemo/FillDemo.js"></script>
the console shows

Error: multipleDefine
return mix(new Error(error), {src:"dojoLoader", info:info});  dojo.js (line 106)
src: dojoLoader   dojo.js (line 1896)
info: Object { pid="dijit",  mid="dijit/_WidgetsInTemplateMixin",  pack={...},  more...}

如果我注释掉了jquery-ui行,错误消失了。

FillDemo.js是我的源代码,以

If I comment out the jquery-ui line, the error goes away.
FillDemo.js is my source code, which starts with

require(
[    "dojo/_base/declare",
     "dijit/_WidgetBase", 
     "dijit/_TemplatedMixin",
     "dijit/_WidgetsInTemplateMixin",
     "dijit/registry",
     "dijit/form/Button", 
     "dijit/form/DropDownButton",


推荐答案

看起来这是一个与jQuery UI加载的顺序的错误,而dojo加载器是初始化的。

It looks like this is an error with the order in which jQuery UI is loaded vs when the dojo loader is intialized.

在这里讨论更多的上下文: https://geonet.esri.com/message/448542# comment-448449

See the discussion here for more context: https://geonet.esri.com/message/448542#comment-448449

解决方案是确保在jQuery UI和jQuery加载后调用dojo加载程序。为此,您可以将dojo的加载移动到HTML页面的底部,并将jQuery和jQueryUI保留在标题中。

The solution is to make sure dojo loader is called after jQuery UI and jQuery have loaded. For this, you can move the loading of dojo to the bottom of the HTML page, and leave jQuery and jQueryUI in the header.

这篇关于错误:来自Dojo&amp; jQuery-UI冲突的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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