lunnlew / baidu-map

BaiduMap Vue3 GL Map Component
https://lunnlew.github.io/baidu-map/
MIT License
15 stars 4 forks source link

局部导入-地图标注失败 #17

Open Lumysia opened 2 years ago

Lumysia commented 2 years ago

问题描述

在局部导入的情况下,地图标注失败

代码

<template>
    <baidu-map
        class="map"
        ref="map"
        :apiKey="'z7ngXdkrDCY1oFfaFLxyvL6UtiXu0f88'"
        :center="point"
        :enableMapClick="true"
        :enableWheelZoom="true"
        :mapType="BMapGLConstant.MapTypeId.BMAP_NORMAL_MAP"
    >
        <bm-marker :point="point" :show="isShowMaker">
            <bm-marker-icon :size="[23, 25]" :anchor="[10, 15]" :imageOffset="[0, 0]"></bm-marker-icon>
        </bm-marker>
    </baidu-map>
</template>

<script setup>
import { BaiduMap, BMapGLConstant } from "baidu-map-vue3";
import { ref } from "vue";

const point = ref({
    lng: 116.403963,
    lat: 39.915119,
});
const isShowMaker = ref(true);
const isShowLabel = ref(true);
</script>

<style>
.map {
    width: 100%;
    height: 500px;
}
</style>

问题 Demo 链接

baidumap-localimport-demo.zip