seajs加载jquery提示$ is not a function

jquery1.7以上的都支持模块化加载,只是jquery默认的是支持amd,不支持cmd。所以要用seajs加载jquery,需要稍微改下jquery

1 if (typeof define === "function" && (define.amd)) {
2     define( "jquery", [], function() {
3         return jQuery;
4     });
5 }

改成

1 if (typeof define === "function" && (define.amd || define.cmd)) {
2     define( "jquery", [], function() {
3         return jQuery;
4     });
5 }

1 if (typeof define === "function") {
2     define( "jquery", [], function() {
3         return jQuery;
4     });
5 }

就可以了

原文地址:https://www.cnblogs.com/ewqv/p/4903480.html