1.将引入的接口更改为:
更改之前:
<script type="text/javascript" src="http://api.map.baidu.com/api?v=1.1&services=true"></script>
更改之后:
<script type="text/javascript" src="https://api.map.baidu.com/api?v=2.0&ak=你申请的秘钥替换&s=1"></script>
2.找到以下参数:
更改之前:
marker.setPoint(point);
var zoom = map.zoomLevel;
var point = marker.getPoint();
var url = "http://api.map.baidu.com/staticimage?center=" + center.lng + ',' + center.lat +"&zoom=" + zoom + "&width=" + size.width + '&height=' + size.height + "&markers=" + point.lng + ',' + point.lat;
更改之后:
marker.setPosition(point);
var zoom = map.zoomLevel;
var point = marker.getPoint();
var url = "https://api.map.baidu.com/staticimage?s=1¢er=" + center.lng + ',' + center.lat +"&zoom=" + zoom + "&width=" + size.width + '&height=' + size.height + "&markers=" + point.lng + ',' + point.lat;
show.html(记得引入新接口):
更改前:
marker = window.marker.getPoint();
更改后:
marker = window.marker.getPosition();