zoukankan      html  css  js  c++  java
  • 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

  • 相关阅读:
    Struts2
    Struts2
    学习python的第九天
    学习python的第八天--作业
    学习python的第七天--作业
    学习python第六天 --作业
    学习python的第六天---1(理论)
    学习python第五天
    学习python第四天
    学习python第三天
  • 原文地址:https://www.cnblogs.com/DayDreamEveryWhere/p/5530089.html
Copyright © 2011-2022 走看看