快乐的琪宝贝
- 发布:2023-02-22 14:09
- 更新:2023-03-29 10:46
- 阅读:276
高德地图可以参考这个临时解决: H5 Map组件高德地图includePoints无效
- map组件中增加监听
mapready
<map ref="map" class="map":latitude="latitude" :longitude="longitude" :markers="markers" :polyline="polyline" @mapready="handleMapReady" > </map>
- 调用高德的
setFitView
方法handleMapReady() { this.$refs.map._map.setFitView() }
快乐的琪宝贝 (作者)
>
</map>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
id: 0, // 使用 marker点击事件 需要填写id
title: "map",
latitude: 39.909,
longitude: 116.39742,
covers: [
{
latitude: 39.909,
longitude: 116.39742,
iconPath:
"https://activity-h5.starcharge.com/wechat/wechatImgs/map/mapAggBg.png",
},
{
latitude: 39.9,
longitude: 117.39,
iconPath:
"https://activity-h5.starcharge.com/wechat/wechatImgs/map/mapAggBg.png",
},
],
mapCtx: "",
};
},
created() {
this.$nextTick(() => {
this.mapCtx = uni.createMapContext("mapId", this);
console.log('this.mapCtx: ', this.mapCtx);
this.mapCtx.includePoints({
points: this.covers,
});
console.log("xaxsasx");
});
},
methods: {},
};
</script>
2023-02-22 15:38