SeaJS,require加载Jquery总是为null
来源:互联网 发布:2016网络对战射击游戏 编辑:程序博客网 时间:2024/06/02 03:18
RT,这个问题困扰了我两天,使用别人的例子、官网down下来的example都没有问题。但是放到自己项目里就 var $=require(“jquery”) 为null。
后来发现,jquery本来没有amd规范的,于是从官网上的example下来里面的jquery拿过来直接用,最注意的是,在jquery里面增加了有define这段,里面有一个路径要根据自己实际项目路径进行调整
if ( typeof module === "object" && module && typeof module.exports === "object" ) { // Expose jQuery as module.exports in loaders that implement the Node // module pattern (including browserify). Do not create the global, since // the user will be storing it themselves locally, and globals are frowned // upon in the Node module world. module.exports = jQuery;} else { // Otherwise expose jQuery to the global object as usual window.jQuery = window.$ = jQuery; // Register as a named AMD module, since jQuery can be concatenated with other // files that may use define, but not via a proper concatenation script that // understands anonymous AMD modules. A named AMD is safest and most robust // way to register. Lowercase jquery is used because AMD module names are // derived from file names, and jQuery is normally delivered in a lowercase // file name. Do this after creating the global so that if an AMD module wants // to call noConflict to hide this version of jQuery, it will work. if ( typeof define === "function" ) { define("lib/jquery/jquery/1.10.1/jquery-debug",[], function () { return jQuery; } ); }}
define(“lib/jquery/jquery/1.10.1/jquery-debug”,[], function () { return jQuery; } );
from:http://blog.csdn.net/adeyi/article/details/18003043
0 0
- SeaJS,require加载Jquery总是为null
- 使用SeaJS,require加载Jquery的时候总是为null
- 使用SeaJS,require加载Jquery的时候总是为null
- seajs加载jquery
- seajs如何正确加载jquery
- jquery转化为seajs模块
- seajs入门2--require
- weblogic获取路径总是为NULL
- Require 加载 jquery -easyui 控件渲染问题
- seajs下require书写约定
- seajs 加载的jquery中,正常引用 却报错 $ 错误
- ie无法识别jquery,‘null’为空或不是对象;js加载顺序问题
- android中webview接收favicon总是获取为null解决方案
- android中webview接收favicon总是获取为null解决方案
- seajs学习(4)----require 书写约定
- seajs学习(4)----require 书写约定
- seaJs 加载器简介
- SeaJS 模块加载器
- Python+opencv 无法正确读取视频文件(已解决)
- 笔记十(重要公式阶段总结)
- 01-复杂度1 最大子列和问题
- c++文件結束符
- 自动填充短信验证码(使用ContentObserver)
- SeaJS,require加载Jquery总是为null
- Asia Regional Contest, Tokyo,Problem C Shopping
- linux下rsync的配置以实现文件夹的同步及常见error总结
- 【线性代数公开课MIT Linear Algebra】 第二十一课 特征值与特征向量
- garch matlab
- 南昌大学软件学院21天大神养成计划_第一天学习心得体会
- Lingo中命令脚本文件使用范例
- UI 第五天 代理设计模式 手势识别器
- 好用的vimrc