B
B
BogdanZots2021-10-18 10:45:49
Yandex maps
BogdanZots, 2021-10-18 10:45:49

How to hang an event handler on Placemark Yandex maps?

Hello everyone, I have this Placemark :

<Placemark
            geometry={coordinates[i]}
            properties={{
              iconContent: `Название кофейни`,
              balloonContent: "421412",
              iconCaption: `Назнавие<strong>${cofeePlaces[i]?.name}</strong>`,
            }}
            options={{
              preset: "islands#darkGreenCircleIcon",
              iconCaptionMaxWidth: "250",
              iconLayout: MyIconContentLayout,
              iconContentLayout: MyIconContentLayout,
            }}
          />
        );
      })}

Where is MyIconContentLayout This
const MyIconContentLayout = ymaps.templateLayoutFactory.createClass(
          `<div id="map_point" class="text">
          <img src="https://cdn1.iconfinder.com/data/icons/bistro-restaurant-part-i/64/bistro-and-restaurant_53-30.png">
           <div class="place_title">
           <div>${cofeePlaces[i]?.name}</div>
           <div>
           <img src="https://cdn1.iconfinder.com/data/icons/interface-travel-and-environment/64/star-interface-256.png" style="width:12px;heigth:12px">
           <span class="text_small">
           4,5 Капучино от 190 р
           </span>
           </div>
           </div>
          </div>`
        );

How can I fire a click event on my Placemark ? I have already tried everything both through window and onclick ... Nothing comes out. Please help :(

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Makarov, 2021-10-18
@serbananas

Try this
<Placemark onDragStart={e => console.log(e))}/>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question