|
var aMap = api.require('aMap');
aMap.open({
rect: {
x: 0,
y: 0,
w: 0,
h: 0
},
showUserLocation: true,
fixedOn: api.frameName,
fixed: true
}, function (r, err0) {
if (r.status) {
aMap.getLocation(function (e, err1) {
if (e.status) {
aMap.getNameFromCoords({
lon: e.lon,
lat: e.lat
}, function (t, err2) {
alert(t.status)
if (t.status) {
alert(t.state);
app.cityname = t.state;
} else {
alert(JSON.stringify(err2));
}
});
} else {
toastMsg(JSON.stringify(err1));
}
});
} else {
toastMsg(JSON.stringify(err0));
}
});
源码 |
|