关于require js加载的时候报错的问题
2024-08-30 10:10:35
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']}
}
});
最新文章
- Unity5 如何做资源管理和增量更新
- 静态时序分析(static timing analysis)
- tomcat 的安装
- [SQL]reName存储过程
- canvas-star6.html
- CentOS 7.0默认使用的是firewall作为防火墙,这里改为iptables防火墙。
- insert时出现主键冲突的处理方法【转载】
- hihoCoder 1389 Sewage Treatment 【二分+网络流+优化】 (ACM-ICPC国际大学生程序设计竞赛北京赛区(2016)网络赛)
- 细说在兄弟连搞上PHP的那些事儿
- Android判断应用程序从后台回到前台
- memcached使用文档
- 团队作业8——第二次项目冲刺(Beta阶段)Day5--5.23
- C#之结尾篇
- 音乐app各部分笔记(一)
- ScrollView与ListView的事件冲突
- docker 打开监听端口
- matlab 画图参考小程序
- SWT table性能改善 -- 使用VirtualTable
- python 爬虫 重复下载 二次请求
- web框架引入