我在首页创建了一个map 使用了plus.geolocation.getCurrentPosition方法 点击按钮跳转到另外一个页面时 在这个页面里面写的plus.geolocation.getCurrentPosition就不执行了 写法和主页上是一样的 我甚至直接把主页的代码全部copy过来也不执行 折腾了一天了
mui.plusReady(function(){
var shopname = plus.webview.currentWebview().title;
var shoppoint1 = plus.webview.currentWebview().point1;
var shoppoint2 = plus.webview.currentWebview().point2;
document.getElementById('title').innerText = shopname;
plus.geolocation.getCurrentPosition(
function(position) {
var codns = position.coords; //获取地理坐标信息;
map = new plus.maps.Map("shopmap");
map.centerAndZoom(new plus.maps.Point(codns.longitude, codns.latitude), 14);
map.showUserLocation( true );
map.showZoomControls(true);
},
function(e) {
document.getElementById('map').innerText = "获取百度定位位置信息失败:" + e.message;
}, {
provider: 'baidu'
}
);
});
常在河边走 (作者)
反复试过了
主页面写法:
可以正常显示 然后跳转到另外一个页面 还是这个写法,地图不显示,如果去掉provider: 'baidu'参数,就可以显示了 但是不显示我的位置 map.showUserLocation(true);没起作用
2015-08-07 12:13
DCloud_Android_ST
测试未发现你所描述的问题
2015-08-07 12:37