如果我从 CDN 加载 Dojo,则一切正常。如果我在本地加载它,mixin 不起作用,并且我在控制台中收到以下错误:
07-01 02:47:22.428:E/Web 控制台(7881):错误:声明:mixin #1 不是可调用的构造函数。在文件:///android_asset/www/libs/dojo/dojo/dojo.js:15
这是一个例子。这工作正常:
<!doctype html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/dojo/1.9.1/dojo/dojo.js" data-dojo-config="parseOnLoad:true, mblForceBookmarkable:true"></script>
<script type="text/javascript">
require([ "dojox/mobile/parser", "dojox/mobile", "dojox/mobile/View", "dojox/mobile/Heading", "dojox/mobile/RoundRectList", "dojox/mobile/ScrollableView", "dojox/mobile/ContentPane", "dojox/mobile/TextBox", "dojox/mobile/EdgeToEdgeList", "dojox/mobile/FilteredListMixin"]);
</script>
<link href="libs/dojo/dojox/mobile/themes/iphone/iphone.css" media="screen"
rel="stylesheet" title="no title" type="text/css">
<link href="libs/dojo/dojox/mobile/themes/iphone/Accordion.css" media="screen"
rel="stylesheet" title="no title" type="text/css">
</head>
<body>
<div id="search" data-dojo-type="dojox/mobile/View">
<h1 data-dojo-type="dojox/mobile/Heading"
data-dojo-props="fixed: 'top'">Filtered RoundRectList</h1>
<ul id="list" data-dojo-type="dojox/mobile/RoundRectList"
data-dojo-mixins="dojox/mobile/FilteredListMixin"
data-dojo-props="placeHolder: 'Search'">
<li data-dojo-props='moveTo:"1.information", transition:"slide"'
data-dojo-type="dojox/mobile/ListItem">Information</li>
<li data-dojo-props='moveTo:"1.urgency", transition:"slide"'
data-dojo-type="dojox/mobile/ListItem">Urgency</li>
<li data-dojo-props='moveTo:"1.data", transition:"slide"'
data-dojo-type="dojox/mobile/ListItem">Data</li>
</ul>
</div>
</body>
</html>
但是,如果我从 CDN 参考更改脚本 src,并使用它:
<script src="libs/dojo/dojo/dojo.js" type="text/javascript" data-dojo-config="parseOnLoad:true, mblForceBookmarkable: true"></script>
然后它不再起作用了。我正在使用标准的 dojo-release-1.9.1。我的 libs 文件夹包含以下文件:
“dojo/dojo/dojo.js”
“dojo/dojox/mobile.js”
“dojo/dojox/mobile”(包括所有子文件夹的整个文件夹)
任何帮助将不胜感激。
——乔什