通常是一个简单的问题.
为什么它总是如此有效:
require.config({
shim: {
'jquery': {exports: 'jQuery'},
'jquery.plugin': { exports: 'jQuery', deps: ['jquery'] },
},
});
define([
'jquery.plugin'
], function($) {
$('body').plugin();
});
因此,这项工作并不总是:
require.config({
shim: {
'jquery': {exports: 'jQuery'},
'jquery.plugin': { deps: ['jquery'] },
},
});
define([
'jquery', 'jquery.plugin'
], function($) {
$('body').plugin();
});
定期触发错误- "TypeError:对象没有方法‘插件’“。
此外,我还意识到在方法定义键时确定了'export‘config参数。当你写到:
define([
'jquery', 'jquery.plugin'
], function(dep1, dep2) {
..
});
dep1并不总是=== dep2 (但有时是O_o)。
这里有什么问题吗?
发布于 2013-12-07 13:57:06
简单回答:
在jQuery中,通过YII资产并行加载另一个url的一个副本( AppAsset::register($this) ).
https://stackoverflow.com/questions/20440731
复制