feat(projects): 新增腾讯地图插件

This commit is contained in:
Soybean
2021-11-10 00:38:23 +08:00
parent ea82edc114
commit 3f02c215c5
5 changed files with 32 additions and 4 deletions

View File

@ -1,6 +1,29 @@
<template>
<div>地图</div>
<div ref="domRef" class="w-full max-h-480px"></div>
</template>
<script setup lang="ts"></script>
<script setup lang="ts">
import { ref, onMounted } from 'vue';
import { useScriptTag } from '@vueuse/core';
import { TENCENT_MAP_SDK_URL } from '@/settings';
const { load } = useScriptTag(TENCENT_MAP_SDK_URL);
const domRef = ref<HTMLDivElement | null>(null);
async function renderBaiduMap() {
await load(true);
const map = new TMap.Map(domRef.value!, {
center: new TMap.LatLng(39.98412, 116.307484),
zoom: 11,
viewMode: '3D'
});
return map;
}
onMounted(() => {
renderBaiduMap();
});
</script>
<style scoped></style>

View File

@ -1,5 +1,5 @@
<template>
<div>
<div class="overflow-hidden">
<n-card title="地图插件" class="h-full shadow-sm rounded-16px">
<n-tabs type="line" class="flex-col-stretch h-full" pane-class="flex-1-hidden">
<n-tab-pane v-for="item in maps" :key="item.id" :name="item.id" :tab="item.label">