周周oo
周周oo
  • 发布:2024-06-11 16:19
  • 更新:2024-06-11 16:30
  • 阅读:26

map组件的@markertap返回的id和markers数组里的id不一致

分类:nvue

在vue文件中测试正常。写到nvue文件就是异常。
map组件代码如下(我使用的是nvue文件)

<template>  
<map v-if="shipinshow" id="mapDiv" @tap="mapstyle" :latitude="latitude" :longitude="longitude"  
            :show-compass='true' :markers="markers" :style="styleMap" @markertap="tapMap" :polyline="polyline"  
            scale="15" :show-location="true" enable-satellite></map>  
</template>

我的markers数组的每条数据是有id的(如下):

[{  
    "id": "1714123570460",  
    "latitude": "31.830225546406965",  
    "longitude": "106.87833586291775",  
    "iconPath": "/static/pagesInspect/biaodian.png",  
    "label": {  
        "content": 1,  
        "bgColor": "#E69627",  
        "color": "#fff",  
        "anchorX": -3,  
        "anchorY": -17  
    },  
    "width": 20,  
    "height": 20  
}, {  
    "id": "1714123571460",  
    "latitude": "31.826513297308214",  
    "longitude": "106.88092771188302",  
    "iconPath": "/static/pagesInspect/biaodian.png",  
    "label": {  
        "content": 2,  
        "bgColor": "#E69627",  
        "color": "#fff",  
        "anchorX": -3,  
        "anchorY": -17  
    },  
    "width": 20,  
    "height": 20  
}, {  
    "id": "1714123572460",  
    "latitude": "31.82796715112406",  
    "longitude": "106.875954669914",  
    "iconPath": "/static/pagesInspect/biaodian.png",  
    "label": {  
        "content": 3,  
        "bgColor": "#E69627",  
        "color": "#fff",  
        "anchorX": -3,  
        "anchorY": -17  
    },  
    "width": 20,  
    "height": 20  
}],

点击markertap事件返回的id与数组不一致
// 点击巡检点

            tapMap(e) {  
                console.log(e ,"markId-------")  
}

打印结果如下:

{  
    "type": "markertap",  
    "timeStamp": 1718091688441,  
    "target": {  
        "id": "mapDiv",  
        "dataset": {},  
        "offsetLeft": 0,  
        "offsetTop": 0  
    },  
    "currentTarget": {  
        "id": "mapDiv",  
        "dataset": {},  
        "offsetLeft": 0,  
        "offsetTop": 0  
    },  
    "detail": {  
        "markerId": 2147483647  
    },  
    "stopPropagation": "function() { [native code] }"  
},
2024-06-11 16:19 负责人:无 分享
已邀请:
周周oo

周周oo (作者) - 周周

id的长度太长了。。。

要回复问题请先登录注册