Answer the question
In order to leave comments, you need to log in
How to make vue component decorator?
now there is a mapbox component and it works great
<mapbox
access-token="your access token"
:map-options="{
style: 'mapbox://styles/mapbox/light-v9',
center: [-96, 37.8],
zoom: 3,
}"
:geolocate-control="{
show: true,
position: 'top-left',
}"
@map-load="loaded"
@map-zoomend="zoomend"
@map-click:points="clicked"
@geolocate-error="geolocateError"
@geolocate-geolocate="geolocate"
/>
import Vue from 'vue'
import VueApexCharts from 'vue-apexcharts'
import Mapbox from 'mapbox-gl-vue'
import MapBoxDraw from 'mapbox-gl-draw'
window.Vue = Vue;
window.Vue.component('apex-charts', VueApexCharts);
window.Vue.component('map-box', Mapbox);
window.Vue.component('map-box-draw', MapBoxDraw);
<?= VueWidget::widget([
'component'=>'map-box',
'property'=>[
'style'=>[
'height'=> "500px"
],
'access-token'=>'',
":map-options"=>[
"style"=>'mapbox://styles/vitaly2litvino/cknpuyit02f8g17o1r9mnqra8',
'center'=>[-68.137343, 45.137451],
'zoom'=>10
],
':fullscreen-control'=>[
"show"=>false,
'position'=> 'top-left'
],
"@map-init"=>"loaded" //вот это меня не устраивает
]
])?>
<script>
import Mapbox from 'mapbox-gl-vue'
import MapBoxDraw from 'mapbox-gl-draw'
export default {
components: { Mapbox },
props: {
"map-options": {
"style": "mapbox://styles/vitaly2litvino/cknpuyit02f8g17o1r9mnqra8"
},
},
methods: {
initialized(map) {
const Draw = new MapBoxDraw();
map.addControl(Draw)
},
},
}
</script>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question