您好,您这边使用的是Classic吗,我这边在移动端测试是没有重复触发的现象的,您可以参考我的测试代码:
<!--********************************************************************
* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
*********************************************************************-->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title data-i18n="resources.title_vectorDataEvent"></title>
<style type="text/css">
body {
margin: 0;
overflow: hidden;
background: #fff;
width: 100%;
height: 100%
}
#map {
position: absolute;
width: 100%;
height: 100%;
}
#toolbar {
position: absolute;
top: 50px;
right: 10px;
text-align: center;
z-index: 100;
border-radius: 4px;
}
</style>
</head>
<body>
<div id="toolbar" class="panel panel-primary">
<div class='panel-heading'>
<h5 class='panel-title text-center' data-i18n="resources.title_vectorDataEvent"></h5></div>
<div class='panel-body content'>
<input type="button" class="btn btn-default" data-i18n="[value]resources.text_input_value_addData" onclick="addData()"/>
</div>
</div>
<div id="map"></div>
<script type="text/javascript" include="bootstrap" src="../js/include-web.js"></script>
<script type="text/javascript" exclude="iclient-classic" src="../../dist/classic/include-classic.js"></script>
<script>
var map, layer, vectorlayer, pointFeature,
host = window.isLocal ? window.server : "https://iserver.supermap.io",
url = host + "/iserver/services/map-world/rest/maps/World";
init();
function init() {
map = new SuperMap.Map("map", {
controls: [
new SuperMap.Control.Zoom(),
new SuperMap.Control.Navigation(),
]
});
map.addControl(new SuperMap.Control.LayerSwitcher(), new SuperMap.Pixel(42, 80));
layer = new SuperMap.Layer.TiledDynamicRESTLayer("World", url, null, {maxResolution: "auto"});
layer.events.on({"layerInitialized": addLayer});
vectorlayer = new SuperMap.Layer.Vector("vectorLayer");
var selectFeature = new SuperMap.Control.SelectFeature(vectorlayer,
{
onSelect:onFeatureSelect
});
map.addControl(selectFeature);
selectFeature.activate();
}
//打开对应的信息框
var infowin = null;
var Nums =0;
//要素被选中时调用此函数,需要传入当前选中要素参数feature
function onFeatureSelect(feature) {
Nums+=1;;
console.log(Nums)
if (infowin) {
try {
infowin.hide();
infowin.destroy();
}
catch (e) {
}
}
var popup = new SuperMap.Popup("test"+Nums,
new SuperMap.LonLat(5,40),
new SuperMap.Size(200,200),
"test"+Nums,
true);
infowin = popup;
map.addPopup(popup);
}
function addLayer() {
map.addLayers([layer, vectorlayer]);
//显示地图范围
map.setCenter(new SuperMap.LonLat(0, 0), 0);
}
var infowin = null;
function closeInfoWin() {
if (infowin) {
try {
infowin.hide();
infowin.destroy();
}
catch (e) {
}
}
}
function addData() {
vectorlayer.removeAllFeatures();
var point = new SuperMap.Geometry.Point(0, 0);
pointFeature = new SuperMap.Feature.Vector(point);
pointFeature.style = {
fillColor: "red",
strokeColor: "yellow",
pointRadius: 7
};
vectorlayer.addFeatures(pointFeature);
}
</script>
</body>
</html>
https://iclient.supermap.io/examples/classic/editor.html#overlay_vectorDataEvent
希望可以帮助到您。