收藏
回答

map组件中 marker 上的气泡 callout渲染出现异常,偶尔部分内容不显示

框架类型 问题类型 API/组件名称 终端类型 微信版本 基础库版本
小程序 Bug cover-view 微信安卓客户端 8.0.48 3.3.5

现象:callout窗口中的内容点击显示时偶尔出现内容显示不全问题,如下图所示

正常情况应如下图所示:


<map id="map" class="map" :markers="markers" :longitude="longitude" :latitude="latitude" @markertap="handleMarkerTap" @tap="handleMapTap" @regionchange="handleMapMove">

                    <cover-view slot="callout">

                        <block v-for="(item, index) in markers" :key="item.userId">

                            <cover-view class="callout-container" :marker-id="item.id" :class="{active: item.id == showCalloutMarkerId}">

                                <cover-view class="callout-container-main">

                                    <cover-view class="callout-header" :class="item.calloutData.status ? 'on-line' : 'off-line'">

                                        <cover-view class="title">{{ item.calloutData.userName }}</cover-view>

                                        <cover-view class="status">

                                            <cover-view class="dot"></cover-view>

                                            <cover-view>{{ item.calloutData.status ? '在线' : '离线' }}</cover-view>

                                        </cover-view>

                                    </cover-view>

                                    <cover-view class="split-line"></cover-view>

                                    <cover-view class="callout-content">

                                        <cover-view class="callout-content-item">

                                            <cover-view class="title">当前位置:</cover-view>

                                            <cover-view class="value">

                                                {{ item.calloutData.address }}

                                            </cover-view>

                                        </cover-view>

                                        <cover-view class="callout-content-item">

                                            <cover-view class="title">最后更新:</cover-view>

                                            <cover-view class="value">

                                                {{ item.calloutData.time }}

                                            </cover-view>

                                        </cover-view>

                                    </cover-view>

                                </cover-view>

                                <cover-view class="callout-arrow"></cover-view>

                            </cover-view>

                        </block>

                    </cover-view>

                </map>

js:

handleMapTap(e) {

    console.log('handleMarkerTap', e);

},

handleMarkerTap(e) {

    console.log('点击了标记点:', e.detail.markerId);

    if(e.markerId == this.showCalloutMarkerId){

        return;

    }

    this.showCalloutMarkerId = e.markerId;

},

handleMapMove() {

}


css:

.callout-container {

        width: 480rpx;

        position: relative;

        z-index: 9999;

        display: none;

        &.active {

            display: block;

        }


        .callout-container-main {

            background: #ffffff;

            padding: 24rpx;

            border-radius: 16rpx;

        }


        .callout-header {

            display: flex;

            justify-content: space-between;

            margin-bottom: 18rpx;


            &.on-line {

                --status-color: #67C23A;

            }

            &.off-line {

                --status-color: #F56C6C;

            }


            .title {

                font-weight: bold;

                font-size: 28rpx;

                color: #333333;

            }

            .status {

                display: flex;

                align-items: center;

                color: var(--status-color);

                font-weight: bold;

                font-size: 28rpx;


                .dot {

                    display: inline-block;

                    width: 16rpx;

                    height: 16rpx;

                    background: var(--status-color);

                    border-radius: 100%;

                    margin-right: 10rpx;

                }

            }

        }


        .callout-content {

            padding-top: 18rpx;

            .callout-content-item {

                display: flex;

                overflow: hidden;


                & + .callout-content-item {

                    margin-top: 24rpx;

                }


                .title {

                    flex-shrink: 0;

                    font-weight: bold;

                    font-size: 28rpx;

                    color: #333333;

                }

                .value {

                    flex: 1;

                    font-size: 28rpx;

                    color: #28A066;

                    overflow: hidden;

                    word-break: break-word;

                    overflow-wrap: break-word;

                    white-space: normal;

                }

            }


        }


        .split-line {

            width: 100%;

            height: 2rpx;

            background: #DBDBDB;

        }


        .callout-arrow {

            margin: auto;

            width: 32rpx;

            height: 32rpx;

            background: #ffffff;

            transform: translate(-50%, -50%) rotate(45deg);

        }

    }

最后一次编辑于  2025-08-07
回答关注问题邀请回答
收藏

1 个回答

  • yu
    yu
    2025-09-25

    朋友,解决了吗


    2025-09-25
    有用
    回复
登录 后发表内容