当前位置: 首页 > news >正文

微信小程序--实现地图定位---获取经纬度

(1)
在这里插入图片描述
(2)在这里插入图片描述
(3)
在这里插入图片描述
html:

	<view class="titleTwo" style="border: none;"><view class="fontSize30 invoiceTile">企业地址</view><view class="invoiceRight" bind:tap="tapChooseAddress"  data-maptype="2"><view class="inputRight fontSize30" style="{{detailedAddress=='请选择企业地址'?'color:#777;':''}} height: auto;" >{{detailedAddress || '请选择企业地址'}}</view></view><view class="clearBoth"></view></view>

js:

	tapChooseAddress(e) {let that = this;let maptype = e.currentTarget.dataset.maptype;// 地图选点wx.chooseLocation({success: function (res) {if(maptype == "1"){that.setData({detailedAddress: res.name,xxdzLongitude: res.longitude,xxdzLatitude: res.latitude,});}else{that.setData({detailedAddress: res.name,xxdzLongitude: res.longitude,//经度xxdzLatitude: res.latitude,//纬度});}},fail: function (err) {console.log(err)wx.showToast({title: '地图位置获取错误',icon: "none"})}})},// res.longitude,//经度//latitude,//纬度

app.json:

   "requiredPrivateInfos": ["getLocation","chooseLocation"],"permission": {"scope.userLocation": {"desc": "获取用户位置信息用于填写收货地址"}},
http://www.lryc.cn/news/416555.html

相关文章:

  • 【Python系列】使用 `isinstance()` 替代 `type()` 函数
  • 【多模态大模型】 BLIP-2 in ICML 2023
  • HPC高性能计算平台
  • 前端常用的几个工具网站
  • 支付功能之代收代付
  • QPixmap
  • Laravel门面之下:构建自定义门面应用的艺术
  • 智启万象 | 2024 Google 开发者大会直播攻略
  • 技巧:print打印内容到控制台时信息显示不全
  • 3.表的操作
  • AI回答:C#项目编译后生成部分文件的主要职责
  • RPC通信的简单流程
  • 前端发版(发包)缓存,需要强制刷新问题处理
  • 洛谷练习(8.4/8.5)
  • DLMS/COSEM中的信息安全:加密算法(下)1
  • ES6中的Promise、async、await,超详细讲解!
  • Modbus poll和Modbus Mbslave的使用
  • 树莓集团的全球化征程:数字媒体产业的本土与国际布局
  • LeetCode面试150——274H指数
  • 【Linux】Linux重定向指南:探索输出重定向与追加重定向的奥秘!
  • Spring AI -快速开发ChatGPT应用
  • Modern C++ 智能指针
  • Python的100道经典练习题,每日一练,必成大神!!!
  • 代码回滚命令
  • [ASIS 2019]Unicorn shop1
  • LangChain与泛型编程:探索代码生成的新维度
  • day25
  • 红黑树的概念和模拟实现[C++]
  • 网络安全应急响应概述
  • 【C++】链表操作技巧综合:重排链表(带你理顺链表的做题思路)