还有这个也是。。点击没有反应呢。。

来源:8-4 步行规划

hyperse

2019-08-30 22:00:01

<!DOCTYPE html>

<html>

<head>

<meta charset="utf-8">

<script type="text/javascript" src="https://webapi.amap.com/maps?v=1.4.11&key=9de88a718781910c9a1c81230827d1ce&plugin=AMap.Walking,AMap.Autocomplete"></script>

<title>步行规划</title>

<style>

*{

padding: 0;

margin: 0;

}

#container{

position: absolute;

top: 0;

left: 0;

width: 100%;

height: 100%;

}

#panel{

position: fixed;

background: white;

top: 10px;

right: 10px;

width: 280px;

}

#search{

width: 200px;

height: 120px;

position: absolute;

left: 10px;

top: 10px;

background: white;

}

</style>

</head>

<body>

<div id="container"></div>

<div id="panel"></div>

<div id="search">

起点:<input type="text" name=""  id="startNode"/><br />

终点:<input type="text" name="" id="endNode"/><br />

<button id="btn">开始导航</button>

</div>

<script>

var map = new AMap.Map('container',{

zoom:11,

center:[116.379391,39.861536],

});

var num = 0, arr = [];

map.on('click',function(e){

num++;

if(num%2 == 1){

arr = [e.lnglat.R,e.lnglat.P];

}else{

new AMap.Walking({

map:map,

panel:'panel'

}).search(new AMap.LngLat(arr[0],arr[1]),new AMpap.LngLat(e.lnglat.R,e.lnglat.P),function(status,data){

console.log(data);

})

}

});

/* new AMap.Walking({

map:map,

panel:'panel'

}).search([116,38],[116,40],function(status,data){

console.log(data);

})

*/

/* new AMap.Walking({

map:map,

panel:'panel'

}).search([

{keyword:'北京南站',city:'北京'},

{keyword:'天宫院',city:'北京'}

],function(status,data){

console.log(data);

}) */

</script>

</body>

</html>


写回答

1回答

好帮手慕夭夭

2019-08-31

你好同学,是因为有单词拼错:

http://img.mukewang.com/climg/5d69dd9f0001f6a207010129.jpg

改为如下:

http://img.mukewang.com/climg/5d69ddac00014cfd07950088.jpg

同学这两天练习不太细心,下次练习的时候,如果代码逻辑写的没有问题 , 但是效果不能实现的情况 , 可以先检查一下是否有多余的符号 , 中文符号 , 拼写错误等一些粗心导致的问题 。提升自己独立解决问题的能力 。当然还是希望同学能够细心一些更好哦。

祝学习愉快,望采纳。

0

0 学习 · 6815 问题

查看课程