HTML:<%for(var i=0;i<deviceList.length;i++){%><div class="am-g good-detial ng-cloak" onclick="gpswalk(<%=deviceList[i].longitude||0 %>,<%=deviceList[i].latitude||0 %>)"><div class="am-u-sm-2" ><a href="" onclick="return false;" ><img src="/files/<%=deviceList[i].img%>" class="scrollLoading" style="margin: 10px 0px 0 10px;" ></a></div><div class="am-u-sm-10"><span style="font-size: 10px;">水机编号:<%=deviceList[i].code%></span><br/><br/><br/><span style="font-size: 10px;"><%=deviceList[i].region+'-'+deviceList[i].address%></span></div></div><hr class="am-margin-top-sm am-margin-bottom-sm"><%}%>JS:var gpswalk = function(lat, lng) { geolocation.getLocation(function(position) { console.log('==gpswalk getLocation=='); console.log(position) var start = new qq.maps.LatLng(position.lat, position.lng); var end = new qq.maps.LatLng(lat, lng); directionsService.setPolicy(qq.maps.DrivingPolicy.LEAST_TIME); directionsService.search(start, end); }); return false;}
添加回答
举报
0/150
提交
取消