小程序-获取用户位置信息

wxml

<button open-type="getUserInfo" bindgetuserinfo="fetchInfo">获取位置</button>
<view bindtap="getLocalPath">{{localPath}}</view>

js

 data: {
    "localPath":"请选择位置"
  },
  getLocalPath:function(){
    var that = this;
//调用微信位置接口 wx.chooseLocation({ success:function(res){ that.setData({localPath:res.address}); }, }) },