码迷,mamicode.com
首页 > 微信 > 详细

微信小程序调用地图选取位置后返回信息

时间:2019-01-08 17:18:43      阅读:218      评论:0      收藏:0      [点我收藏+]

标签:view   inpu   put   com   方法   isa   location   bind   XML   

先看一下wxml的代码,绑定个事件!

<view class=‘carpool_data_all‘>

<view class=‘aa‘>

<text>*出发地</text>

</view>

<view class=‘bb‘ bindtap=‘selectlocation‘>

<input disabled placeholder=‘请选择出发地‘ value="{{departure}}"></input>

</view>

</view>

  然后是js的代码,调用wx.chooseLocation方法

selectlocation:function(){
var that = this
wx.chooseLocation({
success: function (res) {
// success
console.log(res.name)
that.setData({
departure: res.name,
})
},
fail: function () {
// fail
},
complete: function () {
// complete
}
})
},

  

微信小程序调用地图选取位置后返回信息

标签:view   inpu   put   com   方法   isa   location   bind   XML   

原文地址:https://www.cnblogs.com/yuobey/p/10239893.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!