Skip to content

Commit

Permalink
feat(BMap): 优化渲染结构,高度可继承组件外层容器
Browse files Browse the repository at this point in the history
close #70
  • Loading branch information
yue1123 committed Jul 7, 2024
1 parent 181a5c1 commit 5297a8e
Showing 1 changed file with 20 additions and 21 deletions.
41 changes: 20 additions & 21 deletions packages/components/map/index.vue
Original file line number Diff line number Diff line change
@@ -1,24 +1,23 @@
<template>
<div :id="instanceId">
<template v-if="shouldRender">
<div
class="baidu-map-container"
ref="mapContainer"
:style="{ width: width, height: height, background: props.loadingBgColor }"
style="position: relative; overflow: hidden"
>
<slot name="loading">
<div
:style="{ color: props.loadingTextColor }"
style="position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%)"
>
{{ !initd ? 'map loading...' : '' }}
</div>
</slot>
</div>
<template v-if="shouldRender">
<div
:id="instanceId"
class="baidu-map-container"
ref="mapContainer"
:style="{ width: width, height: height, background: props.loadingBgColor }"
style="position: relative; overflow: hidden"
>
<slot name="loading">
<div
:style="{ color: props.loadingTextColor }"
style="position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%)"
>
{{ !initd ? 'map loading...' : '' }}
</div>
</slot>
<slot></slot>
</template>
</div>
</div>
</template>
</template>

<script setup lang="ts">
Expand Down Expand Up @@ -377,7 +376,7 @@
restrictCenter,
minZoom,
maxZoom,
mapType: window[mapType],
mapType: window[mapType as any] as any,
enableAutoResize,
showControls,
displayOptions
Expand Down Expand Up @@ -518,7 +517,7 @@
}
// 设置地图类型
function setMapType(mapType: MapType): void {
window[mapType] !== undefined && map!.setMapType(window[mapType])
window[mapType as any] !== undefined && map!.setMapType(window[mapType as any] as any)
}
function setHeading(heading: number): void {
map!.setHeading(heading)
Expand Down

0 comments on commit 5297a8e

Please sign in to comment.