uniapp的map组件有时候会出现部分灰色的情况,具体什么原因我不知道,猜测是手机浏览器加载地图的时候反应不过来,只加载了部分,其他功能都可以使用但是唯独地图不可使用。目前解决方法是给了一个重绘,直接
<view class="" v-if="mapshow">
<map :style="{ width: '100%', height: mapHeight }" :latitude="latitude" :longitude="longitude" scale="18"
:circles="circles" :show-location="true">
</map>
<view/>
onShow() {
setTimeout(() => {
this.mapshow = true; // 一秒后将 mapShow 设置为 true
console.log(1);
}, 100); // 设置延迟时间为 1000 毫秒(1 秒)
}
每一次进入页面都加载一次map组件