先看一下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 = thiswx.chooseLocation({success: function (res) {// successconsole.log(res.name)that.setData({departure: res.name,})},fail: function () {// fail},complete: function () {// complete}})},