我正在使用一个名为jQuery的马斐尔插件,并试图做一些相当简单的事情。
函数底部的“绘图”对象将向地图中添加绘图点。情节点也是对象。
我的目标是基于外部JSON文件动态生成这些情节点。我提出了几个情节要点供练习,并将其储存在国家对象中。
有没有办法用“国家”对象作为“情节”对象的值?
var country = {
"XM": {
value: 100,
latitude: 22.99131,
longitude: 54.77059
},
"VE": {
value: 200,
latitude: 64.42689,
longitude: 145.23237
},
"SE": {
value: 300,
latitude: 8.96106,
longitude: -15.09699
},
"XF": {
value: 300,
latitude: 50.93900,
longitude: 55.38883
}
}
$('.world').mapael({
// ... other mapael objects to initialize map
plots: {
// country object
}
});发布于 2014-12-10 23:33:10
是。省略大括号,只需引用变量:
$('.world').mapael({
// ...
plots: country
});https://stackoverflow.com/questions/27412827
复制相似问题