V
V
VegasChickiChicki2019-09-19 03:22:19
JavaScript
VegasChickiChicki, 2019-09-19 03:22:19

Vue2-mapbox - how to use dynamic parameters?

I can't figure out how to call map events. For example, I have coordinates and I want to move the map to another location by clicking on the button. Or here's another example, by clicking on the button to change the map zoom. There are map input parameters:

:map-options="mapOption" // на самом компоненте карты 

// а это в data
mapOption: {
                    style: 'mapbox://styles/mapbox/dark-v9',
                    center: [
                        this.$store.state.goods[this.$store.state.currentMap].x,
                        this.$store.state.goods[this.$store.state.currentMap].y
                    ],
                    zoom: this.$store.state.goods[this.$store.state.currentMap].zoom
                },

When I change the parameters of these values, nothing happens, I suppose we need some kind of events or functions that will redraw the map, but I can’t figure out how to do it, I’ll forgive the help.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question