FK JavaScript:ArcGIS JavaScript类库加载不成功而导致的程序异常

现象:页面加载时,有时候成功,有时候出错,出错的地方为init.js 加载esri的类库

经过仔细对比,发现出错时dojo加载的类库中,对象的很多属性都为undefined,而加载成功时,该对象的相关属性都是有值的

加载成功与否基本是随机的.

错误提示:

Uncaught TypeError: Cannot read property 'toLowerCase' of null

目前遇到类似的问题,一般情况出错消息都是上句

出错语句:

出错原因:JQuery类库与Dojo类库产生的冲突,应该是JQuery类库与函数冲突了dojo类库的加载

解决方法:参考下述网址.老外给出了多种解决方案

采用下面的方法,解决了问题(其他方法没有测试):

When jQuery and/or jQuery UI haven't finished loading their modules/scripts but dojo is starting to load, the above if statement seems to prove to be true. Whoever, when you defer loading all dojo stuff until jQuery-ui and jQuery are loaded, the statement will return false (obviously).

I haven't been able to fully test the hypothesis but in practice this works for me:

- load jQuery and jQuery ui in de header, blocking

- load alle my custom code AND the dojo stuff in the footer, deferred

做法就是:在页面的header标签中加载JQuery相关类库

在页面的最下方,加载ArcGIS JavaScript的类库

参考:https://geonet.esri.com/thread/119518

转载于:https://www.cnblogs.com/DayDreamEveryWhere/p/5530089.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值