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

微信小程序坐标位置使用整理(四)map组件

一、地图上标点,marker

1.wxml

<map id="map" scale="9" class="map"markers="{{markers}}" longitude="{{longitude}}" latitude="{{latitude}}" show-location="{{true}}"><cover-view slot="callout"><cover-view wx:for="{{markers}}" wx:key="id" marker-id="{{item.id}}"></cover-view></cover-view>
</map>

2.wxss

// pages/map/map1/map1.js
Page({/*** 页面的初始数据*/data: {latitude: 36.40424100,longitude:  117.59074300,city: "济南",markers: [{"id": 22,"latitude": 36.40424100,"longitude": 117.59074300,"iconPath": "/style/img/index_p5.png","width": 20,"height": 20,"anchor": {"x": 0.5,"y": 1},"zIndex": 5,"callout": {"content": "雪野湖风景区","color": "#000000","fontSize": 20,"display": "BYCLICK","padding": 3}}, {"id": 119,"latitude": 36.56315200,"longitude": 117.07547900,"iconPath": "/style/img/index_p5.png","width": 20,"height": 20,"anchor": {"x": 0.5,"y": 1},"zIndex": 5,"callout": {"content": "777济南滑翔伞飞行营地","color": "#000000","fontSize": 20,"display": "BYCLICK","padding": 3}}, {"id": 120,"latitude": 36.47369800,"longitude": 117.11559300,"iconPath": "/style/img/index_p5.png","width": 20,"height": 20,"anchor": {"x": 0.5,"y": 1},"zIndex": 5,"callout": {"content": "金象山滑雪场","color": "#000000","fontSize": 20,"display": "BYCLICK","padding": 3}}, {"id": 121,"latitude": 36.41929600,"longitude": 117.13822000,"iconPath": "/style/img/index_p5.png","width": 20,"height": 20,"anchor": {"x": 0.5,"y": 1},"zIndex": 5,"callout": {"content": "九顶塔中华民族欢乐园·雪之舞滑雪场","color": "#000000","fontSize": 20,"display": "BYCLICK","padding": 3}}, {"id": 122,"latitude": 1.00000000,"longitude": 1.00000000,"iconPath": "/style/img/index_p5.png","width": 20,"height": 20,"anchor": {"x": 0.5,"y": 1},"zIndex": 5,"callout": {"content": "济南世纪园滑雪场","color": "#000000","fontSize": 20,"display": "BYCLICK","padding": 3}}],},/*** 生命周期函数--监听页面加载*/onLoad(options) {},
})

二、地图上展示范围,方圆范围,circle

特别说明:颜色设置使用十六进制模式,不然有的设备不兼容;例如:#077fff33,#000000

1.wxml

<map id="map" scale="15" class="map" circles="{{circles}}" markers="{{markers}}" longitude="{{longitude}}" latitude="{{latitude}}"><cover-view slot="callout"><cover-view marker-id="1"></cover-view><cover-view marker-id="2"></cover-view></cover-view>
</map>

2.wxss

page{width: 100%;height: 100%;
}
map{width: 100%;height: 100%;
}

3.js

// pages/map/map2/map2.js
var longitude=116.92601214945981;
var latitude=36.666011687933405;
Page({/*** 页面的初始数据*/data: {latitude: latitude,longitude: longitude,jobID: 0,storeID: 0,storeInfo: {}, // 商家信息isSubmitting: false, // 添加提交状态标识circles: [{latitude: latitude,longitude: longitude,color: "#077fff33",fillColor: "#077fff33",radius: 500, // 500m打卡范围strokeWidth: 0,fillOpacity: 0.5,}],markers: [{id: 1,latitude: latitude,longitude: longitude,width: 20,height: 30,anchor: {x: .5,y: 1},zIndex: 5,callout: {content:  '千乐微云', // 显示商家名称color: '#000000',fontSize: 14,display: 'ALWAYS',padding: 3,}}],},/*** 生命周期函数--监听页面加载*/onLoad(options) {},/*** 生命周期函数--监听页面显示*/onShow() {},
})

4.展示效果:

三、

更多:

微信小程序坐标位置接口使用整理(二)地图插件_error: getwxplugincode fail,error: provider:wx50b5-CSDN博客

微信小程序坐标位置接口使用整理(二)地图接口

 微信小程序坐标位置接口使用整理(一)


文章转载自:

http://awt4aZhL.gtgwh.cn
http://aIS9HmYI.gtgwh.cn
http://oVe9rccM.gtgwh.cn
http://8s0VlrFy.gtgwh.cn
http://Rqum3sg8.gtgwh.cn
http://ighljFt7.gtgwh.cn
http://NheiC6mP.gtgwh.cn
http://sQv1dQEM.gtgwh.cn
http://Qez3HUWm.gtgwh.cn
http://S0XfX7v7.gtgwh.cn
http://pIOdNenX.gtgwh.cn
http://yJ5PCrJS.gtgwh.cn
http://ImBR9e9y.gtgwh.cn
http://g2aad3t8.gtgwh.cn
http://FcCOWetT.gtgwh.cn
http://wVT0rlBP.gtgwh.cn
http://WzJhg0sB.gtgwh.cn
http://ojjsdxEe.gtgwh.cn
http://XmpPvun6.gtgwh.cn
http://JPZLEA6i.gtgwh.cn
http://hv8OCnR3.gtgwh.cn
http://XKL5RYaW.gtgwh.cn
http://cNDirKIf.gtgwh.cn
http://fVWTN4MJ.gtgwh.cn
http://L2t3ZkDN.gtgwh.cn
http://pMlSgHAh.gtgwh.cn
http://QKQBAh14.gtgwh.cn
http://KmP6j6gD.gtgwh.cn
http://UKe8ra4H.gtgwh.cn
http://505A8YMU.gtgwh.cn
http://www.dtcms.com/a/382065.html

相关文章:

  • 贪心算法在联邦学习客户端选择问题中的应用
  • 自增主键为何需要返回?
  • JDBC从入门到面试:全面掌握Java数据库连接技术
  • java本机电脑跳过2层网络连到客户内网远程调试方案
  • 基于多元线性回归、随机森林与神经网络的农作物元素含量预测及SHAP贡献量分析
  • MySQL数据库 -- 6.事务
  • CSS :has() 选择器详解:为什么它是“父选择器”?如何实现真正的容器查询?
  • 6-1ASPNETCoreWeb入门
  • 【文献笔记】PointWeb
  • Rupert Baines加入CSA Catapult董事会
  • 解密进程管理:从创建到回收全解析(基于Liunx操作系统)
  • 深度神经网络2——优化器选择、学习率消毒、正则化选择
  • 核心利润获现率
  • Nginx 502 网关错误:upstream 超时配置的踩坑与优化
  • (综述)视觉任务的视觉语言模型
  • 【C语言选择排序算法详解】+ 算法性能优化 + 动态演示实现
  • 基于Matlab硬币圆形检测的实现
  • go使用反射获取http.Request参数到结构体
  • vscode使用tmux技巧
  • 【Block总结】ConverseNet:神经网络中的反向卷积算子
  • C++学习记录(8)list
  • 【C++】STL·List
  • 网络安全与iptables防火墙配置
  • Django + Vue3 前后端分离技术实现自动化测试平台从零到有系列 <第一章> 之 注册登录实现
  • Flink面试题及详细答案100道(41-60)- 状态管理与容错
  • 从基础到高级:一文快速认识MySQL UPDATE 语句
  • 基于KAZE算法的织物图像拼接matlab仿真,对比SIFT和SURF
  • 知识输出零散没有体系怎么办
  • 【LeetCode】37. 解数独
  • Redis常见性能问题