@@ -229,7 +229,26 @@
that.latitude = pos.coords.latitude;
that.longitude = pos.coords.longitude;
that.getCityNameByLonLat(that.latLongItude)
- })
+ },function(err){
+ // 错误处理
+ switch(err.code) {
+ case 1:
+ alert("位置服务被拒绝。");
+ break;
+
+ case 2:
+ alert("暂时获取不到位置信息。");
+ case 3:
+ alert("获取信息超时。");
+ default:
+ alert("未知错误。");
+ }
+ })
}else{
console.log("当前系统不支持GPS API")
};