uni-app实现地图显示圆,气泡callout自定义,轨迹回放、定位到具体某个坐标的功能
前提说明
1、需要在app设置里先配置地图所需要的key
2、因为map的特殊性,所以整个页面程序搭载在.nvue里,调试都需要真机才能看到效果
template
地图组件
<view class="mapContent">
<map id="map" :scale="13" :style="'width: 100%; height:'+windowHeight+'px;'" :latitude="mapData.latitude"
:longitude="mapData.longitude" :markers="markers" scale="16" :show-compass='true' :circles="circles"
@markertap="showMarkDetail" :polyline="polylineData" @callouttap="showMarkDetail">
<cover-view slot="callout">
<template v-for="(item,index) in markers">
<cover-view class="customCallout" :marker-id="item.id">
<cover-view class="content">
<cover-image class="icon" src="/static/person/map/wifi.png"></cover-image>
<cover-view class="test">
<text class="text">{
{ item.markerName }}</text>
</cover-view>
</cover-view>
</cover-view>
</template>
</cover-view>
</map>
</view>
1、windowHeight根据页面的实际大小调整
2、要在map上做层级,只能用
script
data数据
data(){
return{
windowHeight: uni.