React Map - Handle the Related Events
The Map UI component fires the markerAdded and markerRemoved events when a marker is added or removed. To handle them, assign functions to the onMarkerAdded and onMarkerRemoved properties, respectively.
- <template>
- <DxMap
- :zoom="10"
- :center="centerCoordinates"
- @marker-added="markerAdded"
- @marker-removed="markerRemoved"
- />
- </template>
- <script>
- import 'devextreme/dist/css/dx.light.css';
- import { DxMap } from 'devextreme-vue/map';
- export default {
- components: {
- DxMap
- },
- data() {
- return {
- centerCoordinates: { lat: 40.749825, lng: -73.987963 }
- };
- },
- methods: {
- markerAdded(e) {
- const addedMarker = e.options;
- // The original marker used by the current map provider
- const originalMarker = e.originalMarker;
- // Event handling commands go here
- },
- markerRemoved(e) {
- const removedMarker = e.options;
- // Event handling commands go here
- }
- }
- }
- </script>
See Also
Feel free to share topic-related thoughts here.
If you have technical questions, please create a support ticket in the DevExpress Support Center.
Thank you for the feedback!
If you have technical questions, please create a support ticket in the DevExpress Support Center.