fix(projects): 修复百度地图sdk地址

This commit is contained in:
Soybean
2021-11-09 23:49:24 +08:00
parent 6abe094ff2
commit 9a97d23c75
6 changed files with 15 additions and 57 deletions

View File

@ -3,19 +3,18 @@
</template>
<script setup lang="ts">
import { ref, onMounted, nextTick } from 'vue';
import { ref, onMounted } from 'vue';
import { useScriptTag } from '@vueuse/core';
import { BAIDU_MAP_SDK_URL } from '@/settings';
import { useScript } from '@/hooks';
const { load } = useScript(BAIDU_MAP_SDK_URL);
const { load } = useScriptTag(BAIDU_MAP_SDK_URL);
const domRef = ref<HTMLDivElement | null>(null);
async function renderBaiduMap() {
await load();
await nextTick();
const map = new BMapGL.Map(domRef.value!);
const point = new BMapGL.Point(116.404, 39.915);
await load(true);
const map = new BMap.Map(domRef.value!);
const point = new BMap.Point(114.05834626586915, 22.546789983033168);
map.centerAndZoom(point, 15);
map.enableScrollWheelZoom();
}