Quote the api, of Amap js to add a click event to the dot tag, but there is no response.

Amap api, is quoted in the project to add a click event to the dot tag, and there is no response or error

create point tag code:

var marker = new AMap.Marker ({/ / coordinate graph
icon: icon,//24px*26px
position: vue.customer [I] .position,
title: vue.customer [I] .name,
zIndex: 200,
clickable: true,
map: map
});
new AMap.Marker ({/ / coordinate name
content: "< div class="custom" >" + vue.customer [I] .name + "< / div >",
position: vue.customer [I] .position,
offset: new AMap.Pixel (0,0),
zIndex: 200,
map: map
});

add click events to point tags

AMap.event.addListener (marker, "click", function () {
console.log ("1111");
});

after running, the click does not respond or report an error, and the breakpoint shows that there is no entry method

Apr.01,2021
The

method is correct. I wrote the click event outside, so the click event did not trigger

.
Menu