Polymer v1.0列表上创建每个项目时的铁表距离计算
目前,我对聚合铁列表的了解非常少,我想知道从json数据中获取lat和lon坐标并计算每个项目的坐标并插入结果时,计算距离的最佳方法是什么 在Jquery中,这非常简单egPolymer v1.0列表上创建每个项目时的铁表距离计算,polymer,polymer-1.0,Polymer,Polymer 1.0,目前,我对聚合铁列表的了解非常少,我想知道从json数据中获取lat和lon坐标并计算每个项目的坐标并插入结果时,计算距离的最佳方法是什么 在Jquery中,这非常简单eg $.getJSON(getthis, function(data) { $.each(data.items, function(i, value){ itemlat = value.lat; itemlng = value.lng; dist = distance
$.getJSON(getthis, function(data) {
$.each(data.items, function(i, value){
itemlat = value.lat;
itemlng = value.lng;
dist = distance(lat,lng,itemlat,itemlng);
$(".main-content").append("<paper-item>....<span class='dist'>"+dist+"</span></paper-item>");
});
});
谢谢哦,亲爱的,这太简单了
感谢@Ben Thomas提供文档链接
<div class="dist secondary dim"><span>{{doThisOnce(item.lat,item.lng)}}</span>
哦,天哪,这太简单了
感谢@Ben Thomas提供文档链接
<div class="dist secondary dim"><span>{{doThisOnce(item.lat,item.lng)}}</span>
你能澄清一下你所说的“在飞行中”是什么意思吗?@Mowzer on-the-fly——俚语英语,用于实时计算。因此,当(或之前)在铁清单中添加/创建每个项目时,是否有方法获取项目的lat和lon,将它们放入变量中,通过运行findList()计算距离;把结果放进去,你能澄清一下“在飞行中”是什么意思吗?@Mowzer on the fly--俚语英语,用于实时计算。因此,当(或之前)在铁清单中添加/创建每个项目时,是否有方法获取项目的lat和lon,将它们放入变量中,通过运行findList()计算距离;把结果放进去
<div class="dist secondary dim"><span>{{doThisOnce(item.lat,item.lng)}}</span>
Polymer({
is: 'my-request',
handleResponse: function () {
},
doThisOnce: function(lat,lng) {
console.log(lat+"=="+lng);
// calculate distance
// return result
}
});