猿问

无法进入geolocation.getLocation()里面的函数,求解【急】

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;

}


Vol_蒲公英
浏览 2478回答 0
0回答
随时随地看视频慕课网APP
我要回答