<script type="text/javascript" src="/Scripts/jquery-1.8.2.min.js"></script>
<script type="text/javascript" src="/Scripts/jquery.mobile-1.2.0.min.js"></script>
<script type="text/javascript">
console.log(jQuery.mobile !== undefined && 'good'); // prints 'good'!
</script>
<script type="text/javascript" data-main="/comp/pages/Index.js" src="/Scripts/require.js></script>
<script type="text/javascript">
console.log(jQuery.mobile !== undefined && 'good'); // prints 'good'!
</script>
但在我Index.js
的,jQuery.mobile
消失了:
require([], function (view) {
console.log(jQuery.mobile === undefined && 'undefined!'); // prints 'undefined!'
});
我怎么带mobile
回来jQuery
?(我显然不在乎有一些 mobile
in jQuery
,但有兴趣使用jQuery Mobile
with RequireJS
.. 只是为了说清楚..)
编辑1:
我尝试添加require
到 Index.js:
console.log(jQuery.mobile === undefined && 'undefined!'); // prints 'undefined!'
require(['/Scripts/jquery-1.8.2.min.js', '/Scripts/jquery.mobile-1.2.0.min.js'],
function (jQuery,jqm, view) {
console.log(jQuery.mobile === undefined && 'undefined!'); // prints 'undefined!'
});