zoukankan      html  css  js  c++  java
  • 关于require js加载的时候报错的问题

    1.在项目中使用了requery.js  页面总是会出项一些奇怪的错误,如下

    后来经过查找资料才发现,原来是因为依赖 的问题,因为require加载的时候是异步加载,而js之间是有相互依赖的,所以解决办法就是在加载之前添加依赖即可

    require.config({
        baseUrl:path+'/ui/common/',
        paths:{
           'jquery':'js/libs/jquery-1.9.1',
           'domReady':'js/functionality/domReady',
           'jquery.jqGrid':'plugins/other/jqgird/jquery.jqGrid.min',
           'ztree.core':'plugins/other/ztree/jquery.ztree.core',
           'ztree.excheck':'plugins/other/ztree/jquery.ztree.excheck',
           'jquery.validator':'plugins/formElems/newValidator/js/jquery.validator',
           'zh-CN':'plugins/formElems/newValidator/js/zh-CN',
           'util':'js/functionality/Util',
           'DialogBySHF':'plugins/formElems/dialogbyshf/js/DialogBySHF',
           'alert':'plugins/modals/alertBox/AlertBox',
           'WdatePicker':'plugins/formElems/time/DatePicker97/WdatePicker',
            'bootstrap_datetimepicker':'plugins/formElems/time/bootstrap_datetimepicker/js/bootstrap-datetimepicker.min',
            'bootstrap_datetimepicker_zh_CN':'plugins/formElems/time/bootstrap_datetimepicker/js/bootstrap-datetimepicker.zh-CN',
            'echart':'plugins/chart/echarts.min',
           'nicescroll':'plugins/other/nicescroll/jquery.nicescroll.min',
           'bootstrap':'plugins/other/ipanel/bootstrap.min',
           'jquery-ui':'plugins/other/jquery-ui/jquery-ui.min',
           'content':'plugins/other/ipanel/content.min',
           'tree':'plugins/formElems/downTree/ztreeSelect',
        },
    //关键部分
        shim:{
            'jquery-ui':{deps:['jquery']},
            'content':{deps:['jquery']},
                    'bootstrap':{deps:['jquery']},
                    'ztree.core':{deps:['jquery']},
                    'ztree.exchedk':{deps:['ztree.core']}
        }
    });                                    
  • 相关阅读:
    C# Console.Read()和Console.ReadLine()的区别
    C#获取项目程序及运行路径的方法
    Thread理解
    ENVI 监督分类Max stdev from Mean 参数IDL中的设置
    C# 插件开发学习实例
    利用动软代码器自动生存三层架构
    结构体的对齐
    链表分类及应用
    指针
    双向循环链表
  • 原文地址:https://www.cnblogs.com/pengfei25/p/7778388.html
Copyright © 2011-2022 走看看