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

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}); }, }) },

 

posted @ 2020-05-11 12:26  南啾  阅读(427)  评论(0编辑  收藏  举报