Component "pages/post/post" does not have a metho?
发布于 7 年前 作者 wanxia 7991 次浏览 来自 官方Issues

Component "pages/post/post" does not have a method "chooseLocation" to handle event "tap".

<view class="mod t-address" bindtap="chooseLocation">123</view>

wx.chooseLocation({

success: function (res) {

that.setData({

address: res.name,

longitude: res.longitude, //经度

latitude: res.latitude,//纬度

})

if (e.detail && e.detail.value) {

this.data.address = e.detail.value;

}

},

fail: function (e) {

},

complete: function (e) {

}

})


1 回复

please  declare “chooseLocationmethod  in your “page.js” . Like this:

chooseLocation() {
    wx.chooseLocation({
    success: function (res) {
    that.setData({
    address: res.name,
    longitude: res.longitude, //经度
   latitude: res.latitude,//纬度
    })
   //others.
},



  

回到顶部