Call the api, of Amap js to add a click event to the dot tag

add a click event to Amap"s dot mark in the project. For more information, please see the following code:
1. Create a dot tag

new AMap.Marker ({
icon: icon,//24px*26px
position: vue.customer [I] .position,
title: vue.customer [I] .name,
zIndex: 200,
clickable: true,
map: map
});

2. Add a click event to the dot tag

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

3. Click and report an error

marker is not defined

Apr.01,2021

I haven't played Gaud API, but I can guess the cause of the problem by looking at your code: marker is not defined. It is inferred that the previous new instance should be assigned to marker

var marker = new AMap.Marker({
                icon: icon,//24px*26px
                position: vue.customer[i].position,
                title: vue.customer[i].name,
                zIndex: 200,
                clickable: true,
                map: map
               });
               
var clickHandle = AMap.event.addListener(marker, 'click', function() {
                                                            console.log("1111")
                                                          });              

marker is not defined

marker corresponds to the tag entity you want to control.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1c297b1-33976.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1c297b1-33976.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?