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']} } });