获取位置:get.location

type:wgs84(是全球定位系统,获取的坐标,gcj02是国家测绘局给出的坐标)

btnclick:function(){
wx.getLocation({
type:'wgs84',// 默认wgs84
success:function(res){},
fail:function(res){},
complete:function(){}
});
}

查看位置:有两个

第一个:wx.chooseLocation:可以打开地图进行选择,之后返回给 complete

btnclick:function(){
wx.getLocation({
success:function(res){
var latitude = res.latitude;
var longitude = res.longitude;
wx.chooseLocation({
latitude = latitude,
longitude = longitude,
success:function(res){
console.log(res);
},
fail:function(){},
complete:function(){}
});
}
});
}

第二个:wx.openLocation:使用微信内置地图查看位置

btnclick:function(){
wx.getLocation({
success:function(res){
var latitude = res.latitude;
var longitude = res.longitude;
wx.openLocation({
latitude = latitude,
longitude = longitude,
scale:28
});
}
});
}

最新文章

  1. Codeforces Round #381 (Div. 2)D. Alyona and a tree(树+二分+dfs)
  2. OnNcCalcSize改变标题栏等的高度
  3. 1.使用Entity Framwork框架常用的技术手段Code First 和Reverse Engineer Code First
  4. cygwin配置git
  5. (转)c#.net常用字符串函数
  6. C++字符串(String)
  7. URL动态赋值
  8. c++面试常见160问
  9. POJ 3481 & HDU 1908 Double Queue (map运用)
  10. 怎样解决chm类型的文件在Windows操作系统中无法打开
  11. Linux远程连接工具
  12. SQL查询语句练习
  13. Webpack 4 Tutorial: from 0 Conf to Production Mode
  14. 在phpstudy中安装并使用ThinkPHP 5
  15. IDEA中创建maven项目后解决main文件夹下目录不全的问题
  16. ZABBIX安装过程中relocation error报错解决办法
  17. Informatica
  18. 【汤鸿鑫 3D太极】5年目标规划(基本功、套路、实战搏击)
  19. 信用评分卡 (part 3of 7)
  20. 微信公众号之:JSSDK接入以及invalid signature等常见错误问题

热门文章

  1. spring boot 拦截器之WebMvcConfigurerAdapter
  2. 虚拟IP和IP漂移
  3. imx6 hdmi接口支持
  4. window,centos双系统坏了
  5. DM816x算法具体解释--之OSD
  6. 在GIT中创建一个空分支
  7. 接口日志记录AOP实现-LogAspect
  8. Javascript继承机制总结 [转]
  9. ChemDraw加键的两种方法
  10. JavaScript匿名函数和回调函数