<template>
<view class="index">
<map v-if="isUpdate" id="map" style="height: 800px;width:400px"
scale="14" :longitude="longitude" :latitude="latitude" :show-location="showMap" :markers="markers">
<cover-view slot="callout">
<template v-for="(item,index) in markers">
<cover-view :marker-id="item.id" :key="item.id" class="customCallout">
<cover-view>
customCallout
</cover-view>
</cover-view>
</template>
</cover-view>
</map>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
longitude: "", //经度
latitude: "", //纬度
markers: [],
isUpdate: false
}
},
methods: {
// 地图marker点
_mapMarkers() {
// 获取地图的点
let markers = [{
id: 1,
latitude: 40,
longitude: 40,
width: 40,
height: 40,
joinCluster: true,
customCallout: {
display: "ALWAYS"
}
}
]
this.isUpdate = false;
this.$nextTick(() => {
this.isUpdate = true
this.markers = markers
});
},
},
onLoad() {
this._mapMarkers() // 地图marker点
}
}
</script>
<style>
</style>
0 个回复