RequireJS plugin( order.js )
RequireJS plugin( order.js )
http://requirejs.org/
我最近下载了require.js 2.0,但控制台中出现错误:
Uncaught TypeError: Object function (){var g=ga.call(arguments,0),e;if(f&&v(e=g[g.length-1]))e.__requireJsBuild=!0;g.push(d);return b.apply(null,g)} has no method 'nameToUrl'
requirejs 是否仍然支持 order.js 插件?我在网站上看不到其文档。
当我尝试删除文件时,脚本中断。
在我的索引文件中,我在 head 部分包含了 requirejs 脚本:
<!DOCTYPE html>
<html>
<head>
<title>
My Mobile Application
</title>
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.1.0/jquery.mobile-1.1.0.min.css" />
<link rel="stylesheet" href="public/css/style.css" />
<script data-main="scripts/main.js" src="scripts/require.js"></script>
</head>
<body></body>
</html>
然后在我的主.js文件中:
requirejs.config({
//By default load any module IDs from js/lib
baseUrl: 'js/lib',
//except, if the module ID starts with "app",
//load it from the js/app directory. paths
//config is relative to the baseUrl, and
//never includes a ".js" extension since
//the paths config could be for a directory.
paths: {
app: '../app',
assets: '../assets',
views: '../app/views',
templates: '../app/templates',
collections: '../app/collections',
models: '../app/models'
}
});
// Start the main app logic.
requirejs([
'jquery/jquery',
'assets/jqm.config',
'jquery/mobile',
'text'
]);
require([
'app'
],
function( App ){
$(document).ready( function(){
App.initialize();
});
}
);
我确保App.initialize没有任何错误,App.initialize所做的只是简单的地理位置。requirejs 只是要求 order.js,当我输入代码时,它会出现与上面提到的相同的错误。
谢谢!
您不再支持order
的假设是正确的。它被删除以支持shim
配置选项:
因此,订单插件已被删除并遵循以下领导 Tim Branyen 和 Dave Geddes,分别使用和包装,需要 2.0 将这种依赖树规范直接集成到 requireJS 中。
需要 2.0 升级说明 - https://github.com/jrburke/requirejs/wiki/Upgrading-to-RequireJS-2.0
另外,请查看 RequireJS 站点上的shim
文档 - http://requirejs.org/docs/api.html#config-shim
哦,
想通了。
//This is our main applicatoon boot loader or bootstrap
//here we are loading necessary scripts dependencies like
//jquery, jqm.config, mobile, text
requirejs.config({
baseUrl: 'js/libs',
//except, if the module ID starts with "app",
//load it from the js/app directory. paths
//config is relative to the baseUrl, and
//never includes a ".js" extension since
//the paths config could be for a directory.
paths: {
app: '../app',
assets: '../assets',
views: '../app/views',
templates: '../app/templates',
collections: '../app/collections',
models: '../app/models'
}
});
// Start the main app logic.
require(["jquery","assets/jqm.config","jquery/mobile","text","app"],
function(
$,
config,
mobile,
text,
App
) {
//the jquery.alpha.js and jquery.beta.js plugins have been loaded.
$(function() {
App.initialize();
});
});
相关文章:
- 可以't让我的if语句处理js中的html表单输入
- 使用agility.js进行页面布局和合成
- 使用Clipboard.js复制span文本
- 使用JS如何动态更改显示的html文件中的文本背景颜色
- 强制模板刷新ember.js
- 如何编写HTML输入的JS内联
- Angular JS IE9 Hashbang url rewriting
- SQL应该查询's ORDER BY列写入JS代码中
- 使用js:order<创建表时出现问题;tr>并且<td>
- RequireJS plugin( order.js )
- order by and click在ng repeat angular js中不起作用
- 不处理多维数组的角度js-order
- JS中的Order函数
- order - Date值,它们在Angular JS中只是字符串
- D3.js circles order
- JS InfiniteRotator Random Order
- requireJs的order插件:它可以存在于与require.js的base路径不同的路径中吗?
- Angular.js:如何使用order对对象进行排序
- 早午餐.IO brunch-config.js的order.before语义:
- 带数字字段的Angular Js order不能工作