确实是个uni自带的组件 对我非常优化
只需要 在界面中 使用map组件
<template>
<view>
<map></map>
</view>
</template>
这样界面就会出现一个地图啦
为了保证样式 个人建议设置一个宽和高度
css代码参考
map{
width: 750rpx;
height: 750rpx;
}
然后我们还可以改变这个地图定位的经纬度
longitude 控制经度
latitude 控制纬度
参考代码如下
<template>
<view>
<map
:longitude="longitude"
:latitude="latitude"
></map>
</view>
</template>
<script>
export default {
data() {
return {
longitude: 114.728478,
latitude: 33.663325
}
}
}
</script>
<style>
map{
width: 750rpx;
height: 750rpx;
}
</style>