我在使用 dojo 创建图片库时遇到问题。json 文件中的图像不会呈现。我不确定问题是什么。这是我的代码。
<script type="text/javascript">
dojo.require("dojox.image.Gallery");
dojo.require("dojo.data.ItemFileReadStore");
dojo.require("dojo.parser");
djConfig.useCommentedJson=true;
dojo.addOnLoad(function(){
var itemNameMap = {imageThumbAttr: "thumb",imageLargeAttr: "large"};
var request = {query: {}, count: 20};
dijit.byId('gallery1').setDataStore(itemStore,request, itemNameMap);
});
</script>
</head>
<body class="claro">
<div id="gallery1" dojoType="dojox.image.Gallery" style="background-color:gainsboro;">
</div>
<div jsId="itemStore" dojoType="dojo.data.ItemFileReadStore" url="TotalEnrollmentMapData.json"> </div>
json文件是
var maps={identifier:'Enrollment Maps' ,
label:'Maps',
items:[
{ thumb:"maps_2.0/2012 Enrollment.png",
large:"maps_2.0/2012 Enrollment.png",
title:"I'm wide,me"
},
,
{ thumb:"maps_2.0/2012 Enrollment Change.png",
large:"maps_2.0/2012 Enrollment Change.png",
title:"I'm a horizontal picture"},
{ thumb:"maps_2.0/2012 FTIAC Enrollment.png",
large:"maps_2.0/2012 FTIAC Enrollment.png",
title:"I'm another horizontal picture"},
{ thumb:"maps_2.0/2012 FTIAC Enrollment Change.png",
large:"maps_2.0/2012 FTIAC Enrollment Change.png",
title:"I'm a vertical picture"}
]};