Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // GisMap.vue
- <template>
- <div id="2GisMap"></div>
- </template>
- <script>
- import gMap from "2gis-maps";
- export default {
- name: "GisMap",
- props: {
- center: {
- type: Array,
- default: []
- },
- markers: {
- type: Array,
- default: []
- },
- zoom: {
- type: Number,
- default: 13
- },
- },
- methods: {
- init() {
- let map;
- gMap.then(() => {
- map = DG.map("2GisMap", {
- center: this.center,
- zoom: this.zoom
- });
- DG.marker(this.markers).addTo(map);
- });
- }
- },
- mounted() {
- this.init();
- }
- };
- </script>
- // use
- <gis-map
- :center="coords"
- :markers="cords"
- ></gis-map>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement