feat:baidumap
This commit is contained in:
2
.env
2
.env
@ -24,5 +24,5 @@ VITE_APP_DEFAULT_LOGIN_TENANT = 芋道源码
|
|||||||
VITE_APP_DEFAULT_LOGIN_USERNAME = admin
|
VITE_APP_DEFAULT_LOGIN_USERNAME = admin
|
||||||
VITE_APP_DEFAULT_LOGIN_PASSWORD = admin123
|
VITE_APP_DEFAULT_LOGIN_PASSWORD = admin123
|
||||||
|
|
||||||
# 高德地图
|
# 百度地图
|
||||||
VITE_BAIDU_MAP_KEY = 'efHIw2qmH8RzHPxK0z0rbCgzDVLup9LD'
|
VITE_BAIDU_MAP_KEY = 'efHIw2qmH8RzHPxK0z0rbCgzDVLup9LD'
|
||||||
@ -227,7 +227,11 @@ const regeoCode = (lonLat: string) => {
|
|||||||
emits('locateChange', lnglat)
|
emits('locateChange', lnglat)
|
||||||
emits('update:center', lonLat)
|
emits('update:center', lonLat)
|
||||||
|
|
||||||
// 设置标记并获取地址
|
// 先将地图中心点设置到目标位置
|
||||||
|
const point = new window.BMapGL.Point(lnglat[0], lnglat[1])
|
||||||
|
state.map.centerAndZoom(point, 16)
|
||||||
|
|
||||||
|
// 再设置标记并获取地址
|
||||||
setMarker(lnglat)
|
setMarker(lnglat)
|
||||||
getAddress(lnglat)
|
getAddress(lnglat)
|
||||||
}
|
}
|
||||||
@ -246,7 +250,7 @@ const getAddress = (lnglat: any) => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 显式暴露方法,使其可以被父组件访问
|
/** 显式暴露方法,使其可以被父组件访问 */
|
||||||
defineExpose({ regeoCode })
|
defineExpose({ regeoCode })
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
|||||||
@ -93,14 +93,14 @@
|
|||||||
@blur="updateLocationFromCoordinates"
|
@blur="updateLocationFromCoordinates"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<div class="pl-0 w-full ml-[-18px]" v-if="showMap">
|
<div class="pl-0 h-[400px] w-full ml-[-18px]" v-if="showMap">
|
||||||
<Map
|
<Map
|
||||||
:isWrite="true"
|
:isWrite="true"
|
||||||
:clickMap="true"
|
:clickMap="true"
|
||||||
:center="formData.location"
|
:center="formData.location"
|
||||||
@locateChange="handleLocationChange"
|
@locateChange="handleLocationChange"
|
||||||
ref="mapRef"
|
ref="mapRef"
|
||||||
class="h-[400px] w-full"
|
class="h-full w-full"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
Reference in New Issue
Block a user