js代码
// 在地图上面选择地点 chancePleace: function () { var that = this // 地图选择 wx.chooseLocation({ success: function (res) { // success console.log(res, "location") console.log(res.name) console.log(res.address) console.log(res.latitude) console.log(res.longitude) // 设置地点 if (res.name == null || res.name == "" || res.name == undefined) { app.showToast("选择地点不能为空") return false } // 判断否是重复数据 for (var i = 0; i < that.data.pleaceList.length; i++) { if (that.data.pleaceList[i].name == res.name) { app.showToast("不能选择重复的地点!") return false } } that.data.pleaceList.push(res) that.setData({ pleaceList: that.data.pleaceList }) console.log(that.data.pleaceList.length) }, fail: function () { // fail }, complete: function () { // complete } })
调用
<text class='ind-njtex2' bindtap='chancePleace'>选择位置</text>
版权声明:本站所提供的文章、图片等内容均为用户发布或互联网整理而来,仅供学习参考,如有侵犯您的版权,请联系我们客服人员删除。